home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / gengetopt-2.6.lha / gengetopt-2.6 / doc / texinfo.tex (.txt) < prev   
Texinfo Document  |  2000-12-07  |  183KB  |  4,427 lines

  1. % texinfo.tex -- TeX macros to handle Texinfo files.
  2. % Load plain if necessary, i.e., if running under initex.
  3. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
  4. \def\texinfoversion{1999-01-05}%
  5. % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
  6. % Free Software Foundation, Inc.
  7. % This texinfo.tex file is free software; you can redistribute it and/or
  8. % modify it under the terms of the GNU General Public License as
  9. % published by the Free Software Foundation; either version 2, or (at
  10. % your option) any later version.
  11. % This texinfo.tex file is distributed in the hope that it will be
  12. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  13. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. % General Public License for more details.
  15. % You should have received a copy of the GNU General Public License
  16. % along with this texinfo.tex file; see the file COPYING.  If not, write
  17. % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. % Boston, MA 02111-1307, USA.
  19. % In other words, you are welcome to use, share and improve this program.
  20. % You are forbidden to forbid anyone else to use, share and improve
  21. % what you give them.   Help stamp out software-hoarding!
  22. % Please try the latest version of texinfo.tex before submitting bug
  23. % reports; you can get the latest version from:
  24. %   ftp://ftp.gnu.org/pub/gnu/texinfo.tex
  25. %   /home/gd/gnu/doc/texinfo.tex on the GNU machines.
  26. %   (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
  27. %   ftp://tug.org/tex/texinfo.tex
  28. %   ftp://ctan.org/macros/texinfo/texinfo.tex
  29. %   (and all CTAN mirrors, finger ctan@ctan.org for a list).
  30. % The texinfo.tex in the texinfo distribution itself could well be out
  31. % of date, so if that's what you're using, please check.
  32. % Send bug reports to bug-texinfo@gnu.org.
  33. % Please include a precise test case in each bug report,
  34. % including a complete document with which we can reproduce the problem.
  35. % To process a Texinfo manual with TeX, it's most reliable to use the
  36. % texi2dvi shell script that comes with the distribution.  For simple
  37. % manuals, however, you can get away with:
  38. %   tex foo.texi
  39. %   texindex foo.??
  40. %   tex foo.texi
  41. %   tex foo.texi
  42. %   dvips foo.dvi -o # or whatever, to process the dvi file.
  43. % The extra runs of TeX get the cross-reference information correct.
  44. % Sometimes one run after texindex suffices, and sometimes you need more
  45. % than two; texi2dvi does it as many times as necessary.
  46. \message{Loading texinfo [version \texinfoversion]:}
  47. % If in a .fmt file, print the version number
  48. % and turn on active characters that we couldn't do earlier because
  49. % they might have appeared in the input file name.
  50. \everyjob{\message{[Texinfo version \texinfoversion]}%
  51.   \catcode`+=\active \catcode`\_=\active}
  52. % Save some parts of plain tex whose names we will redefine.
  53. \let\ptexb=\b
  54. \let\ptexbullet=\bullet
  55. \let\ptexc=\c
  56. \let\ptexcomma=\,
  57. \let\ptexdot=\.
  58. \let\ptexdots=\dots
  59. \let\ptexend=\end
  60. \let\ptexequiv=\equiv
  61. \let\ptexexclam=\!
  62. \let\ptexi=\i
  63. \let\ptexlbrace=\{
  64. \let\ptexrbrace=\}
  65. \let\ptexstar=\*
  66. \let\ptext=\t
  67. % We never want plain's outer \+ definition in Texinfo.
  68. % For @tex, we can use \tabalign.
  69. \let\+ = \relax
  70. \message{Basics,}
  71. \chardef\other=12
  72. % If this character appears in an error message or help string, it
  73. % starts a new line in the output.
  74. \newlinechar = `^^J
  75. % Set up fixed words for English if not already set.
  76. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  77. \ifx\putwordChapter\undefined  \gdef\putwordChapter{Chapter}\fi
  78. \ifx\putwordfile\undefined     \gdef\putwordfile{file}\fi
  79. \ifx\putwordInfo\undefined     \gdef\putwordInfo{Info}\fi
  80. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  81. \ifx\putwordon\undefined       \gdef\putwordon{on}\fi
  82. \ifx\putwordpage\undefined     \gdef\putwordpage{page}\fi
  83. \ifx\putwordsection\undefined  \gdef\putwordsection{section}\fi
  84. \ifx\putwordSection\undefined  \gdef\putwordSection{Section}\fi
  85. \ifx\putwordsee\undefined      \gdef\putwordsee{see}\fi
  86. \ifx\putwordSee\undefined      \gdef\putwordSee{See}\fi
  87. \ifx\putwordShortContents\undefined  \gdef\putwordShortContents{Short Contents}\fi
  88. \ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
  89. % Ignore a token.
  90. \def\gobble#1{}
  91. \hyphenation{ap-pen-dix}
  92. \hyphenation{mini-buf-fer mini-buf-fers}
  93. \hyphenation{eshell}
  94. \hyphenation{white-space}
  95. % Margin to add to right of even pages, to left of odd pages.
  96. \newdimen \bindingoffset
  97. \newdimen \normaloffset
  98. \newdimen\pagewidth \newdimen\pageheight
  99. % Sometimes it is convenient to have everything in the transcript file
  100. % and nothing on the terminal.  We don't just call \tracingall here,
  101. % since that produces some useless output on the terminal.
  102. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  103. \ifx\eTeXversion\undefined
  104. \def\loggingall{\tracingcommands2 \tracingstats2
  105.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  106.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  107.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  108. \else
  109. \def\loggingall{\tracingcommands3 \tracingstats2
  110.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  111.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  112.    \tracingscantokens1 \tracingassigns1 \tracingifs1
  113.    \tracinggroups1 \tracingnesting2
  114.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  115. % For @cropmarks command.
  116. % Do @cropmarks to get crop marks.
  117. \newif\ifcropmarks
  118. \let\cropmarks = \cropmarkstrue
  119. % Dimensions to add cropmarks at corners.
  120. % Added by P. A. MacKay, 12 Nov. 1986
  121. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  122. \newdimen\cornerlong  \cornerlong=1pc
  123. \newdimen\cornerthick \cornerthick=.3pt
  124. \newdimen\topandbottommargin \topandbottommargin=.75in
  125. % Main output routine.
  126. \chardef\PAGE = 255
  127. \output = {\onepageout{\pagecontents\PAGE}}
  128. \newbox\headlinebox
  129. \newbox\footlinebox
  130. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  131. % does insertions, but you have to call it yourself.
  132. \def\onepageout#1{%
  133.   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  134.   \ifodd\pageno  \advance\hoffset by \bindingoffset
  135.   \else \advance\hoffset by -\bindingoffset\fi
  136.   % Do this outside of the \shipout so @code etc. will be expanded in
  137.   % the headline as they should be, not taken literally (outputting ''code).
  138.   \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
  139.   \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
  140.     % Have to do this stuff outside the \shipout because we want it to
  141.     % take effect in \write's, yet the group defined by the \vbox ends
  142.     % before the \shipout runs.
  143.     %
  144.     \escapechar = `\\     % use backslash in output files.
  145.     \indexdummies         % don't expand commands in the output.
  146.     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
  147.                    % the page break happens to be in the middle of an example.
  148.     \shipout\vbox{%
  149.       \ifcropmarks \vbox to \outervsize\bgroup
  150.         \hsize = \outerhsize
  151.         \vskip-\topandbottommargin
  152.         \vtop to0pt{%
  153.           \line{\ewtop\hfil\ewtop}%
  154.           \nointerlineskip
  155.           \line{%
  156.             \vbox{\moveleft\cornerthick\nstop}%
  157.             \hfill
  158.             \vbox{\moveright\cornerthick\nstop}%
  159.           }%
  160.           \vss}%
  161.         \vskip\topandbottommargin
  162.         \line\bgroup
  163.           \hfil % center the page within the outer (page) hsize.
  164.           \ifodd\pageno\hskip\bindingoffset\fi
  165.           \vbox\bgroup
  166.       \fi
  167.       %
  168.       \unvbox\headlinebox
  169.       \pagebody{#1}%
  170.       \ifdim\ht\footlinebox > 0pt
  171.         % Only leave this space if the footline is nonempty.
  172.         % (We lessened \vsize for it in \oddfootingxxx.)
  173.         % The \baselineskip=24pt in plain's \makefootline has no effect.
  174.         \vskip 2\baselineskip
  175.         \unvbox\footlinebox
  176.       \fi
  177.       %
  178.       \ifcropmarks
  179.           \egroup % end of \vbox\bgroup
  180.         \hfil\egroup % end of (centering) \line\bgroup
  181.         \vskip\topandbottommargin plus1fill minus1fill
  182.         \boxmaxdepth = \cornerthick
  183.         \vbox to0pt{\vss
  184.           \line{%
  185.             \vbox{\moveleft\cornerthick\nsbot}%
  186.             \hfill
  187.             \vbox{\moveright\cornerthick\nsbot}%
  188.           }%
  189.           \nointerlineskip
  190.           \line{\ewbot\hfil\ewbot}%
  191.         }%
  192.       \egroup % \vbox from first cropmarks clause
  193.       \fi
  194.     }% end of \shipout\vbox
  195.   }% end of group with \turnoffactive
  196.   \advancepageno
  197.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  198. \newinsert\margin \dimen\margin=\maxdimen
  199. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  200. {\catcode`\@ =11
  201. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  202. % marginal hacks, juha@viisa.uucp (Juha Takala)
  203. \ifvoid\margin\else % marginal info is present
  204.   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  205. \dimen@=\dp#1 \unvbox#1
  206. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  207. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  208. % Here are the rules for the cropmarks.  Note that they are
  209. % offset so that the space between them is truly \outerhsize or \outervsize
  210. % (P. A. MacKay, 12 November, 1986)
  211. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  212. \def\nstop{\vbox
  213.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  214. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  215. \def\nsbot{\vbox
  216.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  217. % Parse an argument, then pass it to #1.  The argument is the rest of
  218. % the input line (except we remove a trailing comment).  #1 should be a
  219. % macro which expects an ordinary undelimited TeX argument.
  220. \def\parsearg#1{%
  221.   \let\next = #1%
  222.   \begingroup
  223.     \obeylines
  224.     \futurelet\temp\parseargx
  225. % If the next token is an obeyed space (from an @example environment or
  226. % the like), remove it and recurse.  Otherwise, we're done.
  227. \def\parseargx{%
  228.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  229.   \ifx\obeyedspace\temp
  230.     \expandafter\parseargdiscardspace
  231.   \else
  232.     \expandafter\parseargline
  233.   \fi
  234. % Remove a single space (as the delimiter token to the macro call).
  235. {\obeyspaces %
  236.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  237. {\obeylines %
  238.   \gdef\parseargline#1^^M{%
  239.     \endgroup % End of the group started in \parsearg.
  240.     %
  241.     % First remove any @c comment, then any @comment.
  242.     % Result of each macro is put in \toks0.
  243.     \argremovec #1\c\relax %
  244.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  245.     %
  246.     % Call the caller's macro, saved as \next in \parsearg.
  247.     \expandafter\next\expandafter{\the\toks0}%
  248. % Since all \c{,omment} does is throw away the argument, we can let TeX
  249. % do that for us.  The \relax here is matched by the \relax in the call
  250. % in \parseargline; it could be more or less anything, its purpose is
  251. % just to delimit the argument to the \c.
  252. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  253. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  254. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  255. %    @end itemize  @c foo
  256. % will have two active spaces as part of the argument with the
  257. % `itemize'.  Here we remove all active spaces from #1, and assign the
  258. % result to \toks0.
  259. % This loses if there are any *other* active characters besides spaces
  260. % in the argument -- _ ^ +, for example -- since they get expanded.
  261. % Fortunately, Texinfo does not define any such commands.  (If it ever
  262. % does, the catcode of the characters in questionwill have to be changed
  263. % here.)  But this means we cannot call \removeactivespaces as part of
  264. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  265. % that \parsearg gets might well have any character at all in it.
  266. \def\removeactivespaces#1{%
  267.   \begingroup
  268.     \ignoreactivespaces
  269.     \edef\temp{#1}%
  270.     \global\toks0 = \expandafter{\temp}%
  271.   \endgroup
  272. % Change the active space to expand to nothing.
  273. \begingroup
  274.   \obeyspaces
  275.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  276. \endgroup
  277. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  278. %% These are used to keep @begin/@end levels from running away
  279. %% Call \inENV within environments (after a \begingroup)
  280. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  281. \def\ENVcheck{%
  282. \ifENV\errmessage{Still within an environment; press RETURN to continue}
  283. \endgroup\fi} % This is not perfect, but it should reduce lossage
  284. % @begin foo  is the same as @foo, for now.
  285. \newhelp\EMsimple{Press RETURN to continue.}
  286. \outer\def\begin{\parsearg\beginxxx}
  287. \def\beginxxx #1{%
  288. \expandafter\ifx\csname #1\endcsname\relax
  289. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  290. \csname #1\endcsname\fi}
  291. % @end foo executes the definition of \Efoo.
  292. \def\end{\parsearg\endxxx}
  293. \def\endxxx #1{%
  294.   \removeactivespaces{#1}%
  295.   \edef\endthing{\the\toks0}%
  296.   \expandafter\ifx\csname E\endthing\endcsname\relax
  297.     \expandafter\ifx\csname \endthing\endcsname\relax
  298.       % There's no \foo, i.e., no ``environment'' foo.
  299.       \errhelp = \EMsimple
  300.       \errmessage{Undefined command `@end \endthing'}%
  301.     \else
  302.       \unmatchedenderror\endthing
  303.     \fi
  304.   \else
  305.     % Everything's ok; the right environment has been started.
  306.     \csname E\endthing\endcsname
  307.   \fi
  308. % There is an environment #1, but it hasn't been started.  Give an error.
  309. \def\unmatchedenderror#1{%
  310.   \errhelp = \EMsimple
  311.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  312. % Define the control sequence \E#1 to give an unmatched @end error.
  313. \def\defineunmatchedend#1{%
  314.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  315. % Single-spacing is done by various environments (specifically, in
  316. % \nonfillstart and \quotations).
  317. \newskip\singlespaceskip \singlespaceskip = 12.5pt
  318. \def\singlespace{%
  319.   % Why was this kern here?  It messes up equalizing space above and below
  320.   % environments.  --karl, 6may93
  321.   %{\advance \baselineskip by -\singlespaceskip
  322.   %\kern \baselineskip}%
  323.   \setleading \singlespaceskip
  324. %% Simple single-character @ commands
  325. % @@ prints an @
  326. % Kludge this until the fonts are right (grr).
  327. \def\@{{\tt\char64}}
  328. % This is turned off because it was never documented
  329. % and you can use @w{...} around a quote to suppress ligatures.
  330. %% Define @` and @' to be the same as ` and '
  331. %% but suppressing ligatures.
  332. %\def\`{{`}}
  333. %\def\'{{'}}
  334. % Used to generate quoted braces.
  335. \def\mylbrace {{\tt\char123}}
  336. \def\myrbrace {{\tt\char125}}
  337. \let\{=\mylbrace
  338. \let\}=\myrbrace
  339. \begingroup
  340.   % Definitions to produce actual \{ & \} command in an index.
  341.   \catcode`\{ = 12 \catcode`\} = 12
  342.   \catcode`\[ = 1 \catcode`\] = 2
  343.   \catcode`\@ = 0 \catcode`\\ = 12
  344.   @gdef@lbracecmd[\{]%
  345.   @gdef@rbracecmd[\}]%
  346. @endgroup
  347. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  348. % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
  349. \let\, = \c
  350. \let\dotaccent = \.
  351. \def\ringaccent#1{{\accent23 #1}}
  352. \let\tieaccent = \t
  353. \let\ubaraccent = \b
  354. \let\udotaccent = \d
  355. % Other special characters: @questiondown @exclamdown
  356. % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
  357. \def\questiondown{?`}
  358. \def\exclamdown{!`}
  359. % Dotless i and dotless j, used for accents.
  360. \def\imacro{i}
  361. \def\jmacro{j}
  362. \def\dotless#1{%
  363.   \def\temp{#1}%
  364.   \ifx\temp\imacro \ptexi
  365.   \else\ifx\temp\jmacro \j
  366.   \else \errmessage{@dotless can be used only with i or j}%
  367.   \fi\fi
  368. % Be sure we're in horizontal mode when doing a tie, since we make space
  369. % equivalent to this in @example-like environments. Otherwise, a space
  370. % at the beginning of a line will start with \penalty -- and
  371. % since \penalty is valid in vertical mode, we'd end up putting the
  372. % penalty on the vertical list instead of in the new paragraph.
  373. {\catcode`@ = 11
  374.  % Avoid using \@M directly, because that causes trouble
  375.  % if the definition is written into an index file.
  376.  \global\let\tiepenalty = \@M
  377.  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  378. % @: forces normal size whitespace following.
  379. \def\:{\spacefactor=1000 }
  380. % @* forces a line break.
  381. \def\*{\hfil\break\hbox{}\ignorespaces}
  382. % @. is an end-of-sentence period.
  383. \def\.{.\spacefactor=3000 }
  384. % @! is an end-of-sentence bang.
  385. \def\!{!\spacefactor=3000 }
  386. % @? is an end-of-sentence query.
  387. \def\?{?\spacefactor=3000 }
  388. % @w prevents a word break.  Without the \leavevmode, @w at the
  389. % beginning of a paragraph, when TeX is still in vertical mode, would
  390. % produce a whole line of output instead of starting the paragraph.
  391. \def\w#1{\leavevmode\hbox{#1}}
  392. % @group ... @end group forces ... to be all on one page, by enclosing
  393. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  394. % to keep its height that of a normal line.  According to the rules for
  395. % \topskip (p.114 of the TeXbook), the glue inserted is
  396. % max (\topskip - \ht (first item), 0).  If that height is large,
  397. % therefore, no glue is inserted, and the space between the headline and
  398. % the text is small, which looks bad.
  399. \def\group{\begingroup
  400.   \ifnum\catcode13=\active \else
  401.     \errhelp = \groupinvalidhelp
  402.     \errmessage{@group invalid in context where filling is enabled}%
  403.   \fi
  404.   % The \vtop we start below produces a box with normal height and large
  405.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  406.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  407.   % the TeXbook.)  Thus, space below is not quite equal to space
  408.   % above.  But it's pretty close.
  409.   \def\Egroup{%
  410.     \egroup           % End the \vtop.
  411.     \endgroup         % End the \group.
  412.   \vtop\bgroup
  413.     % We have to put a strut on the last line in case the @group is in
  414.     % the midst of an example, rather than completely enclosing it.
  415.     % Otherwise, the interline space between the last line of the group
  416.     % and the first line afterwards is too small.  But we can't put the
  417.     % strut in \Egroup, since there it would be on a line by itself.
  418.     % Hence this just inserts a strut at the beginning of each line.
  419.     \everypar = {\strut}%
  420.     %
  421.     % Since we have a strut on every line, we don't need any of TeX's
  422.     % normal interline spacing.
  423.     \offinterlineskip
  424.     %
  425.     % OK, but now we have to do something about blank
  426.     % lines in the input in @example-like environments, which normally
  427.     % just turn into \lisppar, which will insert no space now that we've
  428.     % turned off the interline space.  Simplest is to make them be an
  429.     % empty paragraph.
  430.     \ifx\par\lisppar
  431.       \edef\par{\leavevmode \par}%
  432.       %
  433.       % Reset ^^M's definition to new definition of \par.
  434.       \obeylines
  435.     \fi
  436.     %
  437.     % Do @comment since we are called inside an environment such as
  438.     % @example, where each end-of-line in the input causes an
  439.     % end-of-line in the output.  We don't want the end-of-line after
  440.     % the `@group' to put extra space in the output.  Since @group
  441.     % should appear on a line by itself (according to the Texinfo
  442.     % manual), we don't worry about eating any user text.
  443.     \comment
  444. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  445. % message, so this ends up printing `@group can only ...'.
  446. \newhelp\groupinvalidhelp{%
  447. group can only be used in environments such as @example,^^J%
  448. where each line of input produces a line of output.}
  449. % @need space-in-mils
  450. % forces a page break if there is not space-in-mils remaining.
  451. \newdimen\mil  \mil=0.001in
  452. \def\need{\parsearg\needx}
  453. % Old definition--didn't work.
  454. %\def\needx #1{\par %
  455. %% This method tries to make TeX break the page naturally
  456. %% if the depth of the box does not fit.
  457. %{\baselineskip=0pt%
  458. %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
  459. %\prevdepth=-1000pt
  460. \def\needx#1{%
  461.   % Go into vertical mode, so we don't make a big box in the middle of a
  462.   % paragraph.
  463.   \par
  464.   % Don't add any leading before our big empty box, but allow a page
  465.   % break, since the best break might be right here.
  466.   \allowbreak
  467.   \nointerlineskip
  468.   \vtop to #1\mil{\vfil}%
  469.   % TeX does not even consider page breaks if a penalty added to the
  470.   % main vertical list is 10000 or more.  But in order to see if the
  471.   % empty box we just added fits on the page, we must make it consider
  472.   % page breaks.  On the other hand, we don't want to actually break the
  473.   % page after the empty box.  So we use a penalty of 9999.
  474.   % There is an extremely small chance that TeX will actually break the
  475.   % page at this \penalty, if there are no other feasible breakpoints in
  476.   % sight.  (If the user is using lots of big @group commands, which
  477.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  478.   % good page breaking, for example.)  However, I could not construct an
  479.   % example where a page broke at this \penalty; if it happens in a real
  480.   % document, then we can reconsider our strategy.
  481.   \penalty9999
  482.   % Back up by the size of the box, whether we did a page break or not.
  483.   \kern -#1\mil
  484.   % Do not allow a page break right after this kern.
  485.   \nobreak
  486. % @br   forces paragraph break
  487. \let\br = \par
  488. % @dots{} output an ellipsis using the current font.
  489. % We do .5em per period so that it has the same spacing in a typewriter
  490. % font as three actual period characters.
  491. \def\dots{%
  492.   \leavevmode
  493.   \hbox to 1.5em{%
  494.     \hskip 0pt plus 0.25fil minus 0.25fil
  495.     .\hss.\hss.%
  496.     \hskip 0pt plus 0.5fil minus 0.5fil
  497. % @enddots{} is an end-of-sentence ellipsis.
  498. \def\enddots{%
  499.   \leavevmode
  500.   \hbox to 2em{%
  501.     \hskip 0pt plus 0.25fil minus 0.25fil
  502.     .\hss.\hss.\hss.%
  503.     \hskip 0pt plus 0.5fil minus 0.5fil
  504.   \spacefactor=3000
  505. % @page    forces the start of a new page
  506. \def\page{\par\vfill\supereject}
  507. % @exdent text....
  508. % outputs text on separate line in roman font, starting at standard page margin
  509. % This records the amount of indent in the innermost environment.
  510. % That's how much \exdent should take out.
  511. \newskip\exdentamount
  512. % This defn is used inside fill environments such as @defun.
  513. \def\exdent{\parsearg\exdentyyy}
  514. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  515. % This defn is used inside nofill environments such as @example.
  516. \def\nofillexdent{\parsearg\nofillexdentyyy}
  517. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  518. \leftline{\hskip\leftskip{\rm#1}}}}
  519. % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
  520. \def\inmargin#1{%
  521. \strut\vadjust{\nobreak\kern-\strutdepth
  522.   \vtop to \strutdepth{\baselineskip\strutdepth\vss
  523.   \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
  524. \newskip\inmarginspacing \inmarginspacing=1cm
  525. \def\strutdepth{\dp\strutbox}
  526. %\hbox{{\rm#1}}\hfil\break}}
  527. % @include file    insert text of that file as input.
  528. % Allow normal characters that  we make active in the argument (a file name).
  529. \def\include{\begingroup
  530.   \catcode`\\=12
  531.   \catcode`~=12
  532.   \catcode`^=12
  533.   \catcode`_=12
  534.   \catcode`|=12
  535.   \catcode`<=12
  536.   \catcode`>=12
  537.   \catcode`+=12
  538.   \parsearg\includezzz}
  539. % Restore active chars for included file.
  540. \def\includezzz#1{\endgroup\begingroup
  541.   % Read the included file in a group so nested @include's work.
  542.   \def\thisfile{#1}%
  543.   \input\thisfile
  544. \endgroup}
  545. \def\thisfile{}
  546. % @center line   outputs that line, centered
  547. \def\center{\parsearg\centerzzz}
  548. \def\centerzzz #1{{\advance\hsize by -\leftskip
  549. \advance\hsize by -\rightskip
  550. \centerline{#1}}}
  551. % @sp n   outputs n lines of vertical space
  552. \def\sp{\parsearg\spxxx}
  553. \def\spxxx #1{\vskip #1\baselineskip}
  554. % @comment ...line which is ignored...
  555. % @c is the same as @comment
  556. % @ignore ... @end ignore  is another way to write a comment
  557. \def\comment{\begingroup \catcode`\^^M=\other%
  558. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  559. \commentxxx}
  560. {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
  561. \let\c=\comment
  562. % @paragraphindent  is defined for the Info formatting commands only.
  563. \let\paragraphindent=\comment
  564. % Prevent errors for section commands.
  565. % Used in @ignore and in failing conditionals.
  566. \def\ignoresections{%
  567. \let\chapter=\relax
  568. \let\unnumbered=\relax
  569. \let\top=\relax
  570. \let\unnumberedsec=\relax
  571. \let\unnumberedsection=\relax
  572. \let\unnumberedsubsec=\relax
  573. \let\unnumberedsubsection=\relax
  574. \let\unnumberedsubsubsec=\relax
  575. \let\unnumberedsubsubsection=\relax
  576. \let\section=\relax
  577. \let\subsec=\relax
  578. \let\subsubsec=\relax
  579. \let\subsection=\relax
  580. \let\subsubsection=\relax
  581. \let\appendix=\relax
  582. \let\appendixsec=\relax
  583. \let\appendixsection=\relax
  584. \let\appendixsubsec=\relax
  585. \let\appendixsubsection=\relax
  586. \let\appendixsubsubsec=\relax
  587. \let\appendixsubsubsection=\relax
  588. \let\contents=\relax
  589. \let\smallbook=\relax
  590. \let\titlepage=\relax
  591. % Used in nested conditionals, where we have to parse the Texinfo source
  592. % and so want to turn off most commands, in case they are used
  593. % incorrectly.
  594. \def\ignoremorecommands{%
  595.   \let\defcodeindex = \relax
  596.   \let\defcv = \relax
  597.   \let\deffn = \relax
  598.   \let\deffnx = \relax
  599.   \let\defindex = \relax
  600.   \let\defivar = \relax
  601.   \let\defmac = \relax
  602.   \let\defmethod = \relax
  603.   \let\defop = \relax
  604.   \let\defopt = \relax
  605.   \let\defspec = \relax
  606.   \let\deftp = \relax
  607.   \let\deftypefn = \relax
  608.   \let\deftypefun = \relax
  609.   \let\deftypevar = \relax
  610.   \let\deftypevr = \relax
  611.   \let\defun = \relax
  612.   \let\defvar = \relax
  613.   \let\defvr = \relax
  614.   \let\ref = \relax
  615.   \let\xref = \relax
  616.   \let\printindex = \relax
  617.   \let\pxref = \relax
  618.   \let\settitle = \relax
  619.   \let\setchapternewpage = \relax
  620.   \let\setchapterstyle = \relax
  621.   \let\everyheading = \relax
  622.   \let\evenheading = \relax
  623.   \let\oddheading = \relax
  624.   \let\everyfooting = \relax
  625.   \let\evenfooting = \relax
  626.   \let\oddfooting = \relax
  627.   \let\headings = \relax
  628.   \let\include = \relax
  629.   \let\lowersections = \relax
  630.   \let\down = \relax
  631.   \let\raisesections = \relax
  632.   \let\up = \relax
  633.   \let\set = \relax
  634.   \let\clear = \relax
  635.   \let\item = \relax
  636. % Ignore @ignore ... @end ignore.
  637. \def\ignore{\doignore{ignore}}
  638. % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
  639. \def\ifinfo{\doignore{ifinfo}}
  640. \def\ifhtml{\doignore{ifhtml}}
  641. \def\ifnottex{\doignore{ifnottex}}
  642. \def\html{\doignore{html}}
  643. \def\menu{\doignore{menu}}
  644. \def\direntry{\doignore{direntry}}
  645. % @dircategory CATEGORY  -- specify a category of the dir file
  646. % which this file should belong to.  Ignore this in TeX.
  647. \let\dircategory = \comment
  648. % Ignore text until a line `@end #1'.
  649. \def\doignore#1{\begingroup
  650.   % Don't complain about control sequences we have declared \outer.
  651.   \ignoresections
  652.   % Define a command to swallow text until we reach `@end #1'.
  653.   % This @ is a catcode 12 token (that is the normal catcode of @ in
  654.   % this texinfo.tex file).  We change the catcode of @ below to match.
  655.   \long\def\doignoretext##1@end #1{\enddoignore}%
  656.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  657.   \catcode32 = 10
  658.   % Ignore braces, too, so mismatched braces don't cause trouble.
  659.   \catcode`\{ = 9
  660.   \catcode`\} = 9
  661.   % We must not have @c interpreted as a control sequence.
  662.   \catcode`\@ = 12
  663.   % Make the letter c a comment character so that the rest of the line
  664.   % will be ignored. This way, the document can have (for example)
  665.   %   @c @end ifinfo
  666.   % and the @end ifinfo will be properly ignored.
  667.   % (We've just changed @ to catcode 12.)
  668.   \catcode`\c = 14
  669.   % And now expand that command.
  670.   \doignoretext
  671. % What we do to finish off ignored text.
  672. \def\enddoignore{\endgroup\ignorespaces}%
  673. \newif\ifwarnedobs\warnedobsfalse
  674. \def\obstexwarn{%
  675.   \ifwarnedobs\relax\else
  676.   % We need to warn folks that they may have trouble with TeX 3.0.
  677.   % This uses \immediate\write16 rather than \message to get newlines.
  678.     \immediate\write16{}
  679.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  680.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  681.     \immediate\write16{If you are running another version of TeX, relax.}
  682.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  683.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  684.     \immediate\write16{  (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
  685.     \immediate\write16{If you are stuck with version 3.0, run the}
  686.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  687.     \immediate\write16{  to use a workaround.}
  688.     \immediate\write16{}
  689.     \global\warnedobstrue
  690.     \fi
  691. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  692. % workaround (which requires the file ``dummy.tfm'' to be installed),
  693. % uncomment the following line:
  694. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  695. % Ignore text, except that we keep track of conditional commands for
  696. % purposes of nesting, up to an `@end #1' command.
  697. \def\nestedignore#1{%
  698.   \obstexwarn
  699.   % We must actually expand the ignored text to look for the @end
  700.   % command, so that nested ignore constructs work.  Thus, we put the
  701.   % text into a \vbox and then do nothing with the result.  To minimize
  702.   % the change of memory overflow, we follow the approach outlined on
  703.   % page 401 of the TeXbook: make the current font be a dummy font.
  704.   \setbox0 = \vbox\bgroup
  705.     % Don't complain about control sequences we have declared \outer.
  706.     \ignoresections
  707.     %
  708.     % Define `@end #1' to end the box, which will in turn undefine the
  709.     % @end command again.
  710.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  711.     %
  712.     % We are going to be parsing Texinfo commands.  Most cause no
  713.     % trouble when they are used incorrectly, but some commands do
  714.     % complicated argument parsing or otherwise get confused, so we
  715.     % undefine them.
  716.     %
  717.     % We can't do anything about stray @-signs, unfortunately;
  718.     % they'll produce `undefined control sequence' errors.
  719.     \ignoremorecommands
  720.     %
  721.     % Set the current font to be \nullfont, a TeX primitive, and define
  722.     % all the font commands to also use \nullfont.  We don't use
  723.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  724.     % might have that installed.  Therefore, math mode will still
  725.     % produce output, but that should be an extremely small amount of
  726.     % stuff compared to the main input.
  727.     %
  728.     \nullfont
  729.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  730.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  731.     \let\tensf = \nullfont
  732.     % Similarly for index fonts (mostly for their use in
  733.     % smallexample)
  734.     \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
  735.     \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
  736.     \let\indsf = \nullfont
  737.     %
  738.     % Don't complain when characters are missing from the fonts.
  739.     \tracinglostchars = 0
  740.     %
  741.     % Don't bother to do space factor calculations.
  742.     \frenchspacing
  743.     %
  744.     % Don't report underfull hboxes.
  745.     \hbadness = 10000
  746.     %
  747.     % Do minimal line-breaking.
  748.     \pretolerance = 10000
  749.     %
  750.     % Do not execute instructions in @tex
  751.     \def\tex{\doignore{tex}}%
  752.     % Do not execute macro definitions.
  753.     % `c' is a comment character, so the word `macro' will get cut off.
  754.     \def\macro{\doignore{ma}}%
  755. % @set VAR sets the variable VAR to an empty value.
  756. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  757. % Since we want to separate VAR from REST-OF-LINE (which might be
  758. % empty), we can't just use \parsearg; we have to insert a space of our
  759. % own to delimit the rest of the line, and then take it out again if we
  760. % didn't need it.  Make sure the catcode of space is correct to avoid
  761. % losing inside @example, for instance.
  762. \def\set{\begingroup\catcode` =10
  763.   \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
  764.   \parsearg\setxxx}
  765. \def\setxxx#1{\setyyy#1 \endsetyyy}
  766. \def\setyyy#1 #2\endsetyyy{%
  767.   \def\temp{#2}%
  768.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  769.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  770.   \fi
  771.   \endgroup
  772. % Can't use \xdef to pre-expand #2 and save some time, since \temp or
  773. % \next or other control sequences that we've defined might get us into
  774. % an infinite loop. Consider `@set foo @cite{bar}'.
  775. \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
  776. % @clear VAR clears (i.e., unsets) the variable VAR.
  777. \def\clear{\parsearg\clearxxx}
  778. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  779. % @value{foo} gets the text saved in variable foo.
  780.   \catcode`\_ = \active
  781.   % We might end up with active _ or - characters in the argument if
  782.   % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
  783.   % such active characters to their normal equivalents.
  784.   \gdef\value{\begingroup
  785.     \catcode`\-=12 \catcode`\_=12
  786.     \indexbreaks \let_\normalunderscore
  787.     \valuexxx}
  788. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  789. % We have this subroutine so that we can handle at least some @value's
  790. % properly in indexes (we \let\value to this in \indexdummies).  Ones
  791. % whose names contain - or _ still won't work, but we can't do anything
  792. % about that.  The command has to be fully expandable, since the result
  793. % winds up in the index file.  This means that if the variable's value
  794. % contains other Texinfo commands, it's almost certain it will fail
  795. % (although perhaps we could fix that with sufficient work to do a
  796. % one-level expansion on the result, instead of complete).
  797. \def\expandablevalue#1{%
  798.   \expandafter\ifx\csname SET#1\endcsname\relax
  799.     {[No value for ``#1'']}%
  800.   \else
  801.     \csname SET#1\endcsname
  802.   \fi
  803. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  804. % with @set.
  805. \def\ifset{\parsearg\ifsetxxx}
  806. \def\ifsetxxx #1{%
  807.   \expandafter\ifx\csname SET#1\endcsname\relax
  808.     \expandafter\ifsetfail
  809.   \else
  810.     \expandafter\ifsetsucceed
  811.   \fi
  812. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  813. \def\ifsetfail{\nestedignore{ifset}}
  814. \defineunmatchedend{ifset}
  815. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  816. % defined with @set, or has been undefined with @clear.
  817. \def\ifclear{\parsearg\ifclearxxx}
  818. \def\ifclearxxx #1{%
  819.   \expandafter\ifx\csname SET#1\endcsname\relax
  820.     \expandafter\ifclearsucceed
  821.   \else
  822.     \expandafter\ifclearfail
  823.   \fi
  824. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  825. \def\ifclearfail{\nestedignore{ifclear}}
  826. \defineunmatchedend{ifclear}
  827. % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
  828. % following, through the first @end iftex (etc.).  Make `@end iftex'
  829. % (etc.) valid only after an @iftex.
  830. \def\iftex{\conditionalsucceed{iftex}}
  831. \def\ifnothtml{\conditionalsucceed{ifnothtml}}
  832. \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
  833. \defineunmatchedend{iftex}
  834. \defineunmatchedend{ifnothtml}
  835. \defineunmatchedend{ifnotinfo}
  836. % We can't just want to start a group at @iftex (for example) and end it
  837. % at @end iftex, since then @set commands inside the conditional have no
  838. % effect (they'd get reverted at the end of the group).  So we must
  839. % define \Eiftex to redefine itself to be its previous value.  (We can't
  840. % just define it to fail again with an ``unmatched end'' error, since
  841. % the @ifset might be nested.)
  842. \def\conditionalsucceed#1{%
  843.   \edef\temp{%
  844.     % Remember the current value of \E#1.
  845.     \let\nece{prevE#1} = \nece{E#1}%
  846.     %
  847.     % At the `@end #1', redefine \E#1 to be its previous value.
  848.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  849.   \temp
  850. % We need to expand lots of \csname's, but we don't want to expand the
  851. % control sequences after we've constructed them.
  852. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  853. % @asis just yields its argument.  Used with @table, for example.
  854. \def\asis#1{#1}
  855. % @math means output in math mode.
  856. % We don't use $'s directly in the definition of \math because control
  857. % sequences like \math are expanded when the toc file is written.  Then,
  858. % we read the toc file back, the $'s will be normal characters (as they
  859. % should be, according to the definition of Texinfo).  So we must use a
  860. % control sequence to switch into and out of math mode.
  861. % This isn't quite enough for @math to work properly in indices, but it
  862. % seems unlikely it will ever be needed there.
  863. \let\implicitmath = $
  864. \def\math#1{\implicitmath #1\implicitmath}
  865. % @bullet and @minus need the same treatment as @math, just above.
  866. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  867. \def\minus{\implicitmath-\implicitmath}
  868. % @refill is a no-op.
  869. \let\refill=\relax
  870. % If working on a large document in chapters, it is convenient to
  871. % be able to disable indexing, cross-referencing, and contents, for test runs.
  872. % This is done with @novalidate (before @setfilename).
  873. \newif\iflinks \linkstrue % by default we want the aux files.
  874. \let\novalidate = \linksfalse
  875. % @setfilename is done at the beginning of every texinfo file.
  876. % So open here the files we need to have open while reading the input.
  877. % This makes it possible to make a .fmt file for texinfo.
  878. \def\setfilename{%
  879.    \iflinks 
  880.      \readauxfile
  881.    \fi % \openindices needs to do some work in any case.
  882.    \openindices
  883.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  884.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  885.    % If texinfo.cnf is present on the system, read it.
  886.    % Useful for site-wide @afourpaper, etc.
  887.    % Just to be on the safe side, close the input stream before the \input.
  888.    \openin 1 texinfo.cnf
  889.    \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
  890.    \closein1
  891.    \temp
  892.    \comment % Ignore the actual filename.
  893. % Called from \setfilename.
  894. \def\openindices{%
  895.   \newindex{cp}%
  896.   \newcodeindex{fn}%
  897.   \newcodeindex{vr}%
  898.   \newcodeindex{tp}%
  899.   \newcodeindex{ky}%
  900.   \newcodeindex{pg}%
  901. % @bye.
  902. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  903. \message{fonts,}
  904. % Font-change commands.
  905. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  906. % So we set up a \sf analogous to plain's \rm, etc.
  907. \newfam\sffam
  908. \def\sf{\fam=\sffam \tensf}
  909. \let\li = \sf % Sometimes we call it \li, not \sf.
  910. % We don't need math for this one.
  911. \def\ttsl{\tenttsl}
  912. % Use Computer Modern fonts at \magstephalf (11pt).
  913. \newcount\mainmagstep
  914. \mainmagstep=\magstephalf
  915. % Set the font macro #1 to the font named #2, adding on the
  916. % specified font prefix (normally `cm').
  917. % #3 is the font's design size, #4 is a scale factor
  918. \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
  919. % Use cm as the default font prefix.
  920. % To specify the font prefix, you must define \fontprefix
  921. % before you read in texinfo.tex.
  922. \ifx\fontprefix\undefined
  923. \def\fontprefix{cm}
  924. % Support font families that don't use the same naming scheme as CM.
  925. \def\rmshape{r}
  926. \def\rmbshape{bx}               %where the normal face is bold
  927. \def\bfshape{b}
  928. \def\bxshape{bx}
  929. \def\ttshape{tt}
  930. \def\ttbshape{tt}
  931. \def\ttslshape{sltt}
  932. \def\itshape{ti}
  933. \def\itbshape{bxti}
  934. \def\slshape{sl}
  935. \def\slbshape{bxsl}
  936. \def\sfshape{ss}
  937. \def\sfbshape{ss}
  938. \def\scshape{csc}
  939. \def\scbshape{csc}
  940. \ifx\bigger\relax
  941. \let\mainmagstep=\magstep1
  942. \setfont\textrm\rmshape{12}{1000}
  943. \setfont\texttt\ttshape{12}{1000}
  944. \else
  945. \setfont\textrm\rmshape{10}{\mainmagstep}
  946. \setfont\texttt\ttshape{10}{\mainmagstep}
  947. % Instead of cmb10, you many want to use cmbx10.
  948. % cmbx10 is a prettier font on its own, but cmb10
  949. % looks better when embedded in a line with cmr10.
  950. \setfont\textbf\bfshape{10}{\mainmagstep}
  951. \setfont\textit\itshape{10}{\mainmagstep}
  952. \setfont\textsl\slshape{10}{\mainmagstep}
  953. \setfont\textsf\sfshape{10}{\mainmagstep}
  954. \setfont\textsc\scshape{10}{\mainmagstep}
  955. \setfont\textttsl\ttslshape{10}{\mainmagstep}
  956. \font\texti=cmmi10 scaled \mainmagstep
  957. \font\textsy=cmsy10 scaled \mainmagstep
  958. % A few fonts for @defun, etc.
  959. \setfont\defbf\bxshape{10}{\magstep1} %was 1314
  960. \setfont\deftt\ttshape{10}{\magstep1}
  961. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  962. % Fonts for indices and small examples (9pt).
  963. % We actually use the slanted font rather than the italic,
  964. % because texinfo normally uses the slanted fonts for that.
  965. % Do not make many font distinctions in general in the index, since they
  966. % aren't very useful.
  967. \setfont\ninett\ttshape{9}{1000}
  968. \setfont\ninettsl\ttslshape{10}{900}
  969. \setfont\indrm\rmshape{9}{1000}
  970. \setfont\indit\itshape{9}{1000}
  971. \setfont\indsl\slshape{9}{1000}
  972. \let\indtt=\ninett
  973. \let\indttsl=\ninettsl
  974. \let\indsf=\indrm
  975. \let\indbf=\indrm
  976. \setfont\indsc\scshape{10}{900}
  977. \font\indi=cmmi9
  978. \font\indsy=cmsy9
  979. % Fonts for title page:
  980. \setfont\titlerm\rmbshape{12}{\magstep3}
  981. \setfont\titleit\itbshape{10}{\magstep4}
  982. \setfont\titlesl\slbshape{10}{\magstep4}
  983. \setfont\titlett\ttbshape{12}{\magstep3}
  984. \setfont\titlettsl\ttslshape{10}{\magstep4}
  985. \setfont\titlesf\sfbshape{17}{\magstep1}
  986. \let\titlebf=\titlerm
  987. \setfont\titlesc\scbshape{10}{\magstep4}
  988. \font\titlei=cmmi12 scaled \magstep3
  989. \font\titlesy=cmsy10 scaled \magstep4
  990. \def\authorrm{\secrm}
  991. % Chapter (and unnumbered) fonts (17.28pt).
  992. \setfont\chaprm\rmbshape{12}{\magstep2}
  993. \setfont\chapit\itbshape{10}{\magstep3}
  994. \setfont\chapsl\slbshape{10}{\magstep3}
  995. \setfont\chaptt\ttbshape{12}{\magstep2}
  996. \setfont\chapttsl\ttslshape{10}{\magstep3}
  997. \setfont\chapsf\sfbshape{17}{1000}
  998. \let\chapbf=\chaprm
  999. \setfont\chapsc\scbshape{10}{\magstep3}
  1000. \font\chapi=cmmi12 scaled \magstep2
  1001. \font\chapsy=cmsy10 scaled \magstep3
  1002. % Section fonts (14.4pt).
  1003. \setfont\secrm\rmbshape{12}{\magstep1}
  1004. \setfont\secit\itbshape{10}{\magstep2}
  1005. \setfont\secsl\slbshape{10}{\magstep2}
  1006. \setfont\sectt\ttbshape{12}{\magstep1}
  1007. \setfont\secttsl\ttslshape{10}{\magstep2}
  1008. \setfont\secsf\sfbshape{12}{\magstep1}
  1009. \let\secbf\secrm
  1010. \setfont\secsc\scbshape{10}{\magstep2}
  1011. \font\seci=cmmi12 scaled \magstep1
  1012. \font\secsy=cmsy10 scaled \magstep2
  1013. % \setfont\ssecrm\bxshape{10}{\magstep1}    % This size an font looked bad.
  1014. % \setfont\ssecit\itshape{10}{\magstep1}    % The letters were too crowded.
  1015. % \setfont\ssecsl\slshape{10}{\magstep1}
  1016. % \setfont\ssectt\ttshape{10}{\magstep1}
  1017. % \setfont\ssecsf\sfshape{10}{\magstep1}
  1018. %\setfont\ssecrm\bfshape{10}{1315}      % Note the use of cmb rather than cmbx.
  1019. %\setfont\ssecit\itshape{10}{1315}      % Also, the size is a little larger than
  1020. %\setfont\ssecsl\slshape{10}{1315}      % being scaled magstep1.
  1021. %\setfont\ssectt\ttshape{10}{1315}
  1022. %\setfont\ssecsf\sfshape{10}{1315}
  1023. %\let\ssecbf=\ssecrm
  1024. % Subsection fonts (13.15pt).
  1025. \setfont\ssecrm\rmbshape{12}{\magstephalf}
  1026. \setfont\ssecit\itbshape{10}{1315}
  1027. \setfont\ssecsl\slbshape{10}{1315}
  1028. \setfont\ssectt\ttbshape{12}{\magstephalf}
  1029. \setfont\ssecttsl\ttslshape{10}{1315}
  1030. \setfont\ssecsf\sfbshape{12}{\magstephalf}
  1031. \let\ssecbf\ssecrm
  1032. \setfont\ssecsc\scbshape{10}{\magstep1}
  1033. \font\sseci=cmmi12 scaled \magstephalf
  1034. \font\ssecsy=cmsy10 scaled 1315
  1035. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  1036. % but that is not a standard magnification.
  1037. % In order for the font changes to affect most math symbols and letters,
  1038. % we have to define the \textfont of the standard families.  Since
  1039. % texinfo doesn't allow for producing subscripts and superscripts, we
  1040. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  1041. % also require loading a lot more fonts).
  1042. \def\resetmathfonts{%
  1043.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  1044.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  1045.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  1046. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  1047. % of just \STYLE.  We do this so that font changes will continue to work
  1048. % in math mode, where it is the current \fam that is relevant in most
  1049. % cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
  1050. % \tenbf}, for example.  By redefining \tenbf, we obviate the need to
  1051. % redefine \bf itself.
  1052. \def\textfonts{%
  1053.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  1054.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  1055.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
  1056.   \resetmathfonts}
  1057. \def\titlefonts{%
  1058.   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  1059.   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  1060.   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  1061.   \let\tenttsl=\titlettsl
  1062.   \resetmathfonts \setleading{25pt}}
  1063. \def\titlefont#1{{\titlefonts\rm #1}}
  1064. \def\chapfonts{%
  1065.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  1066.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  1067.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
  1068.   \resetmathfonts \setleading{19pt}}
  1069. \def\secfonts{%
  1070.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  1071.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  1072.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
  1073.   \resetmathfonts \setleading{16pt}}
  1074. \def\subsecfonts{%
  1075.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  1076.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  1077.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
  1078.   \resetmathfonts \setleading{15pt}}
  1079. \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
  1080. \def\indexfonts{%
  1081.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  1082.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  1083.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
  1084.   \resetmathfonts \setleading{12pt}}
  1085. % Set up the default fonts, so we can use them for creating boxes.
  1086. \textfonts
  1087. % Define these so they can be easily changed for other fonts.
  1088. \def\angleleft{$\langle$}
  1089. \def\angleright{$\rangle$}
  1090. % Count depth in font-changes, for error checks
  1091. \newcount\fontdepth \fontdepth=0
  1092. % Fonts for short table of contents.
  1093. \setfont\shortcontrm\rmshape{12}{1000}
  1094. \setfont\shortcontbf\bxshape{12}{1000}
  1095. \setfont\shortcontsl\slshape{12}{1000}
  1096. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  1097. %% serif) and @ii for TeX italic
  1098. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  1099. % unless the following character is such as not to need one.
  1100. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  1101. \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
  1102. \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
  1103. \let\i=\smartitalic
  1104. \let\var=\smartslanted
  1105. \let\dfn=\smartslanted
  1106. \let\emph=\smartitalic
  1107. \let\cite=\smartslanted
  1108. \def\b#1{{\bf #1}}
  1109. \let\strong=\b
  1110. % We can't just use \exhyphenpenalty, because that only has effect at
  1111. % the end of a paragraph.  Restore normal hyphenation at the end of the
  1112. % group within which \nohyphenation is presumably called.
  1113. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  1114. \def\restorehyphenation{\hyphenchar\font = `- }
  1115. \def\t#1{%
  1116.   {\tt \rawbackslash \frenchspacing #1}%
  1117.   \null
  1118. \let\ttfont=\t
  1119. \def\samp#1{`\tclose{#1}'\null}
  1120. \setfont\smallrm\rmshape{8}{1000}
  1121. \font\smallsy=cmsy9
  1122. \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
  1123.   \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  1124.     \vbox{\hrule\kern-0.4pt
  1125.      \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  1126.     \kern-0.4pt\hrule}%
  1127.   \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  1128. % The old definition, with no lozenge:
  1129. %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
  1130. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  1131. % @file, @option are the same as @samp.
  1132. \let\file=\samp
  1133. \let\option=\samp
  1134. % @code is a modification of @t,
  1135. % which makes spaces the same size as normal in the surrounding text.
  1136. \def\tclose#1{%
  1137.     % Change normal interword space to be same as for the current font.
  1138.     \spaceskip = \fontdimen2\font
  1139.     %
  1140.     % Switch to typewriter.
  1141.     \tt
  1142.     %
  1143.     % But `\ ' produces the large typewriter interword space.
  1144.     \def\ {{\spaceskip = 0pt{} }}%
  1145.     %
  1146.     % Turn off hyphenation.
  1147.     \nohyphenation
  1148.     %
  1149.     \rawbackslash
  1150.     \frenchspacing
  1151.     #1%
  1152.   \null
  1153. % We *must* turn on hyphenation at `-' and `_' in \code.
  1154. % Otherwise, it is too hard to avoid overfull hboxes
  1155. % in the Emacs manual, the Library manual, etc.
  1156. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  1157. % both hyphenation at - and hyphenation within words.
  1158. % We must therefore turn them both off (\tclose does that)
  1159. % and arrange explicitly to hyphenate at a dash.
  1160. %  -- rms.
  1161.   \catcode`\-=\active
  1162.   \catcode`\_=\active
  1163.   \global\def\code{\begingroup
  1164.     \catcode`\-=\active \let-\codedash
  1165.     \catcode`\_=\active \let_\codeunder
  1166.     \codex
  1167.   % If we end up with any active - characters when handling the index,
  1168.   % just treat them as a normal -.
  1169.   \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
  1170. \def\realdash{-}
  1171. \def\codedash{-\discretionary{}{}{}}
  1172. \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
  1173. \def\codex #1{\tclose{#1}\endgroup}
  1174. %\let\exp=\tclose  %Was temporary
  1175. % @kbd is like @code, except that if the argument is just one @key command,
  1176. % then @kbd has no effect.
  1177. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  1178. %   `example' (@kbd uses ttsl only inside of @example and friends),
  1179. %   or `code' (@kbd uses normal tty font always).
  1180. \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
  1181. \def\kbdinputstylexxx#1{%
  1182.   \def\arg{#1}%
  1183.   \ifx\arg\worddistinct
  1184.     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  1185.   \else\ifx\arg\wordexample
  1186.     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  1187.   \else\ifx\arg\wordcode
  1188.     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  1189.   \fi\fi\fi
  1190. \def\worddistinct{distinct}
  1191. \def\wordexample{example}
  1192. \def\wordcode{code}
  1193. % Default is kbdinputdistinct.  (Too much of a hassle to call the macro,
  1194. % the catcodes are wrong for parsearg to work.)
  1195. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
  1196. \def\xkey{\key}
  1197. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  1198. \ifx\one\xkey\ifx\threex\three \key{#2}%
  1199. \else{\tclose{\kbdfont\look}}\fi
  1200. \else{\tclose{\kbdfont\look}}\fi}
  1201. % For @url, @env, @command quotes seem unnecessary, so use \code.
  1202. \let\url=\code
  1203. \let\env=\code
  1204. \let\command=\code
  1205. % @uref (abbreviation for `urlref') takes an optional second argument
  1206. % specifying the text to display.  First (mandatory) arg is the url.
  1207. % Perhaps eventually put in a hypertex \special here.
  1208. \def\uref#1{\urefxxx #1,,\finish}
  1209. \def\urefxxx#1,#2,#3\finish{%
  1210.   \setbox0 = \hbox{\ignorespaces #2}%
  1211.   \ifdim\wd0 > 0pt
  1212.     \unhbox0\ (\code{#1})%
  1213.   \else
  1214.     \code{#1}%
  1215.   \fi
  1216. % rms does not like the angle brackets --karl, 17may97.
  1217. % So now @email is just like @uref.
  1218. %\def\email#1{\angleleft{\tt #1}\angleright}
  1219. \let\email=\uref
  1220. % Check if we are currently using a typewriter font.  Since all the
  1221. % Computer Modern typewriter fonts have zero interword stretch (and
  1222. % shrink), and it is reasonable to expect all typewriter fonts to have
  1223. % this property, we can check that font parameter.
  1224. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  1225. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  1226. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  1227. \def\dmn#1{\thinspace #1}
  1228. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  1229. % @l was never documented to mean ``switch to the Lisp font'',
  1230. % and it is not used as such in any manual I can find.  We need it for
  1231. % Polish suppressed-l.  --karl, 22sep96.
  1232. %\def\l#1{{\li #1}\null}
  1233. % Explicit font changes: @r, @sc, undocumented @ii.
  1234. \def\r#1{{\rm #1}}              % roman font
  1235. \def\sc#1{{\smallcaps#1}}       % smallcaps font
  1236. \def\ii#1{{\it #1}}             % italic font
  1237. % @acronym downcases the argument and prints in smallcaps.
  1238. \def\acronym#1{{\smallcaps \lowercase{#1}}}
  1239. % @pounds{} is a sterling sign.
  1240. \def\pounds{{\it\$}}
  1241. \message{page headings,}
  1242. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  1243. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  1244. % First the title page.  Must do @settitle before @titlepage.
  1245. \newif\ifseenauthor
  1246. \newif\iffinishedtitlepage
  1247. % Do an implicit @contents or @shortcontents after @end titlepage if the
  1248. % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
  1249. \newif\ifsetcontentsaftertitlepage
  1250.  \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
  1251. \newif\ifsetshortcontentsaftertitlepage
  1252.  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
  1253. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  1254. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  1255.         \endgroup\page\hbox{}\page}
  1256. \def\titlepage{\begingroup \parindent=0pt \textfonts
  1257.    \let\subtitlerm=\tenrm
  1258.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  1259.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  1260.    % Leave some space at the very top of the page.
  1261.    \vglue\titlepagetopglue
  1262.    % Now you can print the title using @title.
  1263.    \def\title{\parsearg\titlezzz}%
  1264.    \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
  1265.                     % print a rule at the page bottom also.
  1266.                     \finishedtitlepagefalse
  1267.                     \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  1268.    % No rule at page bottom unless we print one at the top with @title.
  1269.    \finishedtitlepagetrue
  1270.    % Now you can put text using @subtitle.
  1271.    \def\subtitle{\parsearg\subtitlezzz}%
  1272.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  1273.    % @author should come last, but may come many times.
  1274.    \def\author{\parsearg\authorzzz}%
  1275.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  1276.       {\authorfont \leftline{##1}}}%
  1277.    % Most title ``pages'' are actually two pages long, with space
  1278.    % at the top of the second.  We don't want the ragged left on the second.
  1279.    \let\oldpage = \page
  1280.    \def\page{%
  1281.       \iffinishedtitlepage\else
  1282.          \finishtitlepage
  1283.       \fi
  1284.       \oldpage
  1285.       \let\page = \oldpage
  1286.       \hbox{}}%
  1287. %   \def\page{\oldpage \hbox{}}
  1288. \def\Etitlepage{%
  1289.    \iffinishedtitlepage\else
  1290.       \finishtitlepage
  1291.    \fi
  1292.    % It is important to do the page break before ending the group,
  1293.    % because the headline and footline are only empty inside the group.
  1294.    % If we use the new definition of \page, we always get a blank page
  1295.    % after the title page, which we certainly don't want.
  1296.    \oldpage
  1297.    \endgroup
  1298.    % If they want short, they certainly want long too.
  1299.    \ifsetshortcontentsaftertitlepage
  1300.      \shortcontents
  1301.      \contents
  1302.      \global\let\shortcontents = \relax
  1303.      \global\let\contents = \relax
  1304.    \fi
  1305.    \ifsetcontentsaftertitlepage
  1306.      \contents
  1307.      \global\let\contents = \relax
  1308.      \global\let\shortcontents = \relax
  1309.    \fi
  1310.    \HEADINGSon
  1311. \def\finishtitlepage{%
  1312.    \vskip4pt \hrule height 2pt width \hsize
  1313.    \vskip\titlepagebottomglue
  1314.    \finishedtitlepagetrue
  1315. %%% Set up page headings and footings.
  1316. \let\thispage=\folio
  1317. \newtoks\evenheadline    % headline on even pages
  1318. \newtoks\oddheadline     % headline on odd pages
  1319. \newtoks\evenfootline    % footline on even pages
  1320. \newtoks\oddfootline     % footline on odd pages
  1321. % Now make Tex use those variables
  1322. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  1323.                             \else \the\evenheadline \fi}}
  1324. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  1325.                             \else \the\evenfootline \fi}\HEADINGShook}
  1326. \let\HEADINGShook=\relax
  1327. % Commands to set those variables.
  1328. % For example, this is what  @headings on  does
  1329. % @evenheading @thistitle|@thispage|@thischapter
  1330. % @oddheading @thischapter|@thispage|@thistitle
  1331. % @evenfooting @thisfile||
  1332. % @oddfooting ||@thisfile
  1333. \def\evenheading{\parsearg\evenheadingxxx}
  1334. \def\oddheading{\parsearg\oddheadingxxx}
  1335. \def\everyheading{\parsearg\everyheadingxxx}
  1336. \def\evenfooting{\parsearg\evenfootingxxx}
  1337. \def\oddfooting{\parsearg\oddfootingxxx}
  1338. \def\everyfooting{\parsearg\everyfootingxxx}
  1339. {\catcode`\@=0 %
  1340. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1341. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1342. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1343. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1344. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1345. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1346. \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  1347. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1348. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1349. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1350. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1351. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1352.   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  1353.   % Leave some space for the footline.  Hopefully ok to assume
  1354.   % @evenfooting will not be used by itself.
  1355.   \global\advance\pageheight by -\baselineskip
  1356.   \global\advance\vsize by -\baselineskip
  1357. \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  1358. }% unbind the catcode of @.
  1359. % @headings double      turns headings on for double-sided printing.
  1360. % @headings single      turns headings on for single-sided printing.
  1361. % @headings off         turns them off.
  1362. % @headings on          same as @headings double, retained for compatibility.
  1363. % @headings after       turns on double-sided headings after this page.
  1364. % @headings doubleafter turns on double-sided headings after this page.
  1365. % @headings singleafter turns on single-sided headings after this page.
  1366. % By default, they are off at the start of a document,
  1367. % and turned `on' after @end titlepage.
  1368. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1369. \def\HEADINGSoff{
  1370. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1371. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1372. \HEADINGSoff
  1373. % When we turn headings on, set the page number to 1.
  1374. % For double-sided printing, put current file name in lower left corner,
  1375. % chapter name on inside top of right hand pages, document
  1376. % title on inside top of left hand pages, and page numbers on outside top
  1377. % edge of all pages.
  1378. \def\HEADINGSdouble{
  1379. \global\pageno=1
  1380. \global\evenfootline={\hfil}
  1381. \global\oddfootline={\hfil}
  1382. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1383. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1384. \global\let\contentsalignmacro = \chapoddpage
  1385. \let\contentsalignmacro = \chappager
  1386. % For single-sided printing, chapter title goes across top left of page,
  1387. % page number on top right.
  1388. \def\HEADINGSsingle{
  1389. \global\pageno=1
  1390. \global\evenfootline={\hfil}
  1391. \global\oddfootline={\hfil}
  1392. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1393. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1394. \global\let\contentsalignmacro = \chappager
  1395. \def\HEADINGSon{\HEADINGSdouble}
  1396. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1397. \let\HEADINGSdoubleafter=\HEADINGSafter
  1398. \def\HEADINGSdoublex{%
  1399. \global\evenfootline={\hfil}
  1400. \global\oddfootline={\hfil}
  1401. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1402. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1403. \global\let\contentsalignmacro = \chapoddpage
  1404. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1405. \def\HEADINGSsinglex{%
  1406. \global\evenfootline={\hfil}
  1407. \global\oddfootline={\hfil}
  1408. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1409. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1410. \global\let\contentsalignmacro = \chappager
  1411. % Subroutines used in generating headings
  1412. % Produces Day Month Year style of output.
  1413. \def\today{\number\day\space
  1414. \ifcase\month\or
  1415. January\or February\or March\or April\or May\or June\or
  1416. July\or August\or September\or October\or November\or December\fi
  1417. \space\number\year}
  1418. % Use this if you want the Month Day, Year style of output.
  1419. %\def\today{\ifcase\month\or
  1420. %January\or February\or March\or April\or May\or June\or
  1421. %July\or August\or September\or October\or November\or December\fi
  1422. %\space\number\day, \number\year}
  1423. % @settitle line...  specifies the title of the document, for headings
  1424. % It generates no output of its own
  1425. \def\thistitle{No Title}
  1426. \def\settitle{\parsearg\settitlezzz}
  1427. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1428. \message{tables,}
  1429. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1430. % default indentation of table text
  1431. \newdimen\tableindent \tableindent=.8in
  1432. % default indentation of @itemize and @enumerate text
  1433. \newdimen\itemindent  \itemindent=.3in
  1434. % margin between end of table item and start of table text.
  1435. \newdimen\itemmargin  \itemmargin=.1in
  1436. % used internally for \itemindent minus \itemmargin
  1437. \newdimen\itemmax
  1438. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1439. % these defs.
  1440. % They also define \itemindex
  1441. % to index the item name in whatever manner is desired (perhaps none).
  1442. \newif\ifitemxneedsnegativevskip
  1443. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  1444. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1445. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1446. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1447. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1448. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1449. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1450. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1451.                  \itemzzz {#1}}
  1452. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1453.                  \itemzzz {#1}}
  1454. \def\itemzzz #1{\begingroup %
  1455.   \advance\hsize by -\rightskip
  1456.   \advance\hsize by -\tableindent
  1457.   \setbox0=\hbox{\itemfont{#1}}%
  1458.   \itemindex{#1}%
  1459.   \nobreak % This prevents a break before @itemx.
  1460.   % If the item text does not fit in the space we have, put it on a line
  1461.   % by itself, and do not allow a page break either before or after that
  1462.   % line.  We do not start a paragraph here because then if the next
  1463.   % command is, e.g., @kindex, the whatsit would get put into the
  1464.   % horizontal list on a line by itself, resulting in extra blank space.
  1465.   \ifdim \wd0>\itemmax
  1466.     %
  1467.     % Make this a paragraph so we get the \parskip glue and wrapping,
  1468.     % but leave it ragged-right.
  1469.     \begingroup
  1470.       \advance\leftskip by-\tableindent
  1471.       \advance\hsize by\tableindent
  1472.       \advance\rightskip by0pt plus1fil
  1473.       \leavevmode\unhbox0\par
  1474.     \endgroup
  1475.     %
  1476.     % We're going to be starting a paragraph, but we don't want the
  1477.     % \parskip glue -- logically it's part of the @item we just started.
  1478.     \nobreak \vskip-\parskip
  1479.     %
  1480.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1481.     % we can't prevent a possible page break at the following
  1482.     % \baselineskip glue.
  1483.     \nobreak
  1484.     \endgroup
  1485.     \itemxneedsnegativevskipfalse
  1486.   \else
  1487.     % The item text fits into the space.  Start a paragraph, so that the
  1488.     % following text (if any) will end up on the same line.  
  1489.     \noindent
  1490.     % Do this with kerns and \unhbox so that if there is a footnote in
  1491.     % the item text, it can migrate to the main vertical list and
  1492.     % eventually be printed.
  1493.     \nobreak\kern-\tableindent
  1494.     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  1495.     \unhbox0
  1496.     \nobreak\kern\dimen0
  1497.     \endgroup
  1498.     \itemxneedsnegativevskiptrue
  1499.   \fi
  1500. \def\item{\errmessage{@item while not in a table}}
  1501. \def\itemx{\errmessage{@itemx while not in a table}}
  1502. \def\kitem{\errmessage{@kitem while not in a table}}
  1503. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1504. \def\xitem{\errmessage{@xitem while not in a table}}
  1505. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1506. % Contains a kludge to get @end[description] to work.
  1507. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1508. % @table, @ftable, @vtable.
  1509. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1510. {\obeylines\obeyspaces%
  1511. \gdef\tablex #1^^M{%
  1512. \tabley\dontindex#1        \endtabley}}
  1513. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1514. {\obeylines\obeyspaces%
  1515. \gdef\ftablex #1^^M{%
  1516. \tabley\fnitemindex#1        \endtabley
  1517. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1518. \let\Etable=\relax}}
  1519. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1520. {\obeylines\obeyspaces%
  1521. \gdef\vtablex #1^^M{%
  1522. \tabley\vritemindex#1        \endtabley
  1523. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1524. \let\Etable=\relax}}
  1525. \def\dontindex #1{}
  1526. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1527. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1528. {\obeyspaces %
  1529. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1530. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1531. \def\tablez #1#2#3#4#5#6{%
  1532. \aboveenvbreak %
  1533. \begingroup %
  1534. \def\Edescription{\Etable}% Necessary kludge.
  1535. \let\itemindex=#1%
  1536. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1537. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1538. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1539. \def\itemfont{#2}%
  1540. \itemmax=\tableindent %
  1541. \advance \itemmax by -\itemmargin %
  1542. \advance \leftskip by \tableindent %
  1543. \exdentamount=\tableindent
  1544. \parindent = 0pt
  1545. \parskip = \smallskipamount
  1546. \ifdim \parskip=0pt \parskip=2pt \fi%
  1547. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1548. \let\item = \internalBitem %
  1549. \let\itemx = \internalBitemx %
  1550. \let\kitem = \internalBkitem %
  1551. \let\kitemx = \internalBkitemx %
  1552. \let\xitem = \internalBxitem %
  1553. \let\xitemx = \internalBxitemx %
  1554. % This is the counter used by @enumerate, which is really @itemize
  1555. \newcount \itemno
  1556. \def\itemize{\parsearg\itemizezzz}
  1557. \def\itemizezzz #1{%
  1558.   \begingroup % ended by the @end itemize
  1559.   \itemizey {#1}{\Eitemize}
  1560. \def\itemizey #1#2{%
  1561. \aboveenvbreak %
  1562. \itemmax=\itemindent %
  1563. \advance \itemmax by -\itemmargin %
  1564. \advance \leftskip by \itemindent %
  1565. \exdentamount=\itemindent
  1566. \parindent = 0pt %
  1567. \parskip = \smallskipamount %
  1568. \ifdim \parskip=0pt \parskip=2pt \fi%
  1569. \def#2{\endgraf\afterenvbreak\endgroup}%
  1570. \def\itemcontents{#1}%
  1571. \let\item=\itemizeitem}
  1572. % Set sfcode to normal for the chars that usually have another value.
  1573. % These are `.?!:;,'
  1574. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1575.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1576. % \splitoff TOKENS\endmark defines \first to be the first token in
  1577. % TOKENS, and \rest to be the remainder.
  1578. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1579. % Allow an optional argument of an uppercase letter, lowercase letter,
  1580. % or number, to specify the first label in the enumerated list.  No
  1581. % argument is the same as `1'.
  1582. \def\enumerate{\parsearg\enumeratezzz}
  1583. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1584. \def\enumeratey #1 #2\endenumeratey{%
  1585.   \begingroup % ended by the @end enumerate
  1586.   % If we were given no argument, pretend we were given `1'.
  1587.   \def\thearg{#1}%
  1588.   \ifx\thearg\empty \def\thearg{1}\fi
  1589.   % Detect if the argument is a single token.  If so, it might be a
  1590.   % letter.  Otherwise, the only valid thing it can be is a number.
  1591.   % (We will always have one token, because of the test we just made.
  1592.   % This is a good thing, since \splitoff doesn't work given nothing at
  1593.   % all -- the first parameter is undelimited.)
  1594.   \expandafter\splitoff\thearg\endmark
  1595.   \ifx\rest\empty
  1596.     % Only one token in the argument.  It could still be anything.
  1597.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1598.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1599.     %   not equal to itself.
  1600.     % Otherwise, we assume it's a number.
  1601.     %
  1602.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1603.     % continuing to look for a <number>.
  1604.     %
  1605.     \ifnum\lccode\expandafter`\thearg=0\relax
  1606.       \numericenumerate % a number (we hope)
  1607.     \else
  1608.       % It's a letter.
  1609.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1610.         \lowercaseenumerate % lowercase letter
  1611.       \else
  1612.         \uppercaseenumerate % uppercase letter
  1613.       \fi
  1614.     \fi
  1615.   \else
  1616.     % Multiple tokens in the argument.  We hope it's a number.
  1617.     \numericenumerate
  1618.   \fi
  1619. % An @enumerate whose labels are integers.  The starting integer is
  1620. % given in \thearg.
  1621. \def\numericenumerate{%
  1622.   \itemno = \thearg
  1623.   \startenumeration{\the\itemno}%
  1624. % The starting (lowercase) letter is in \thearg.
  1625. \def\lowercaseenumerate{%
  1626.   \itemno = \expandafter`\thearg
  1627.   \startenumeration{%
  1628.     % Be sure we're not beyond the end of the alphabet.
  1629.     \ifnum\itemno=0
  1630.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1631.                   alphabet}%
  1632.     \fi
  1633.     \char\lccode\itemno
  1634. % The starting (uppercase) letter is in \thearg.
  1635. \def\uppercaseenumerate{%
  1636.   \itemno = \expandafter`\thearg
  1637.   \startenumeration{%
  1638.     % Be sure we're not beyond the end of the alphabet.
  1639.     \ifnum\itemno=0
  1640.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1641.                   alphabet}
  1642.     \fi
  1643.     \char\uccode\itemno
  1644. % Call itemizey, adding a period to the first argument and supplying the
  1645. % common last two arguments.  Also subtract one from the initial value in
  1646. % \itemno, since @item increments \itemno.
  1647. \def\startenumeration#1{%
  1648.   \advance\itemno by -1
  1649.   \itemizey{#1.}\Eenumerate\flushcr
  1650. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1651. % to @enumerate.
  1652. \def\alphaenumerate{\enumerate{a}}
  1653. \def\capsenumerate{\enumerate{A}}
  1654. \def\Ealphaenumerate{\Eenumerate}
  1655. \def\Ecapsenumerate{\Eenumerate}
  1656. % Definition of @item while inside @itemize.
  1657. \def\itemizeitem{%
  1658. \advance\itemno by 1
  1659. {\let\par=\endgraf \smallbreak}%
  1660. \ifhmode \errmessage{In hmode at itemizeitem}\fi
  1661. {\parskip=0in \hskip 0pt
  1662. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1663. \vadjust{\penalty 1200}}%
  1664. \flushcr}
  1665. % @multitable macros
  1666. % Amy Hendrickson, 8/18/94, 3/6/96
  1667. % @multitable ... @end multitable will make as many columns as desired.
  1668. % Contents of each column will wrap at width given in preamble.  Width
  1669. % can be specified either with sample text given in a template line,
  1670. % or in percent of \hsize, the current width of text on page.
  1671. % Table can continue over pages but will only break between lines.
  1672. % To make preamble:
  1673. % Either define widths of columns in terms of percent of \hsize:
  1674. %   @multitable @columnfractions .25 .3 .45
  1675. %   @item ...
  1676. %   Numbers following @columnfractions are the percent of the total
  1677. %   current hsize to be used for each column. You may use as many
  1678. %   columns as desired.
  1679. % Or use a template:
  1680. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1681. %   @item ...
  1682. %   using the widest term desired in each column.
  1683. % For those who want to use more than one line's worth of words in
  1684. % the preamble, break the line within one argument and it
  1685. % will parse correctly, i.e.,
  1686. %     @multitable {Column 1 template} {Column 2 template} {Column 3
  1687. %      template}
  1688. % Not:
  1689. %     @multitable {Column 1 template} {Column 2 template}
  1690. %      {Column 3 template}
  1691. % Each new table line starts with @item, each subsequent new column
  1692. % starts with @tab. Empty columns may be produced by supplying @tab's
  1693. % with nothing between them for as many times as empty columns are needed,
  1694. % ie, @tab@tab@tab will produce two empty columns.
  1695. % @item, @tab, @multitable or @end multitable do not need to be on their
  1696. % own lines, but it will not hurt if they are.
  1697. % Sample multitable:
  1698. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1699. %   @item first col stuff @tab second col stuff @tab third col
  1700. %   @item
  1701. %   first col stuff
  1702. %   @tab
  1703. %   second col stuff
  1704. %   @tab
  1705. %   third col
  1706. %   @item first col stuff @tab second col stuff
  1707. %   @tab Many paragraphs of text may be used in any column.
  1708. %         They will wrap at the width determined by the template.
  1709. %   @item@tab@tab This will be in third column.
  1710. %   @end multitable
  1711. % Default dimensions may be reset by user.
  1712. % @multitableparskip is vertical space between paragraphs in table.
  1713. % @multitableparindent is paragraph indent in table.
  1714. % @multitablecolmargin is horizontal space to be left between columns.
  1715. % @multitablelinespace is space to leave between table items, baseline
  1716. %                                                            to baseline.
  1717. %   0pt means it depends on current normal line spacing.
  1718. \newskip\multitableparskip
  1719. \newskip\multitableparindent
  1720. \newdimen\multitablecolspace
  1721. \newskip\multitablelinespace
  1722. \multitableparskip=0pt
  1723. \multitableparindent=6pt
  1724. \multitablecolspace=12pt
  1725. \multitablelinespace=0pt
  1726. % Macros used to set up halign preamble:
  1727. \let\endsetuptable\relax
  1728. \def\xendsetuptable{\endsetuptable}
  1729. \let\columnfractions\relax
  1730. \def\xcolumnfractions{\columnfractions}
  1731. \newif\ifsetpercent
  1732. % #1 is the part of the @columnfraction before the decimal point, which
  1733. % is presumably either 0 or the empty string (but we don't check, we
  1734. % just throw it away).  #2 is the decimal part, which we use as the
  1735. % percent of \hsize for this column.
  1736. \def\pickupwholefraction#1.#2 {%
  1737.   \global\advance\colcount by 1
  1738.   \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
  1739.   \setuptable
  1740. \newcount\colcount
  1741. \def\setuptable#1{%
  1742.   \def\firstarg{#1}%
  1743.   \ifx\firstarg\xendsetuptable
  1744.     \let\go = \relax
  1745.   \else
  1746.     \ifx\firstarg\xcolumnfractions
  1747.       \global\setpercenttrue
  1748.     \else
  1749.       \ifsetpercent
  1750.          \let\go\pickupwholefraction
  1751.       \else
  1752.          \global\advance\colcount by 1
  1753.          \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
  1754.                             % typically that is always in the input, anyway.
  1755.          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  1756.       \fi
  1757.     \fi
  1758.     \ifx\go\pickupwholefraction
  1759.       % Put the argument back for the \pickupwholefraction call, so
  1760.       % we'll always have a period there to be parsed.
  1761.       \def\go{\pickupwholefraction#1}%
  1762.     \else
  1763.       \let\go = \setuptable
  1764.     \fi%
  1765.   \fi
  1766.   \go
  1767. % multitable syntax
  1768. \def\tab{&\hskip1sp\relax} % 2/2/96
  1769.                            % tiny skip here makes sure this column space is
  1770.                            % maintained, even if it is never used.
  1771. % @multitable ... @end multitable definitions:
  1772. \def\multitable{\parsearg\dotable}
  1773. \def\dotable#1{\bgroup
  1774.   \vskip\parskip
  1775.   \let\item\crcr
  1776.   \tolerance=9500
  1777.   \hbadness=9500
  1778.   \setmultitablespacing
  1779.   \parskip=\multitableparskip
  1780.   \parindent=\multitableparindent
  1781.   \overfullrule=0pt
  1782.   \global\colcount=0
  1783.   \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
  1784.   % To parse everything between @multitable and @item:
  1785.   \setuptable#1 \endsetuptable
  1786.   % \everycr will reset column counter, \colcount, at the end of
  1787.   % each line. Every column entry will cause \colcount to advance by one.
  1788.   % The table preamble
  1789.   % looks at the current \colcount to find the correct column width.
  1790.   \everycr{\noalign{%
  1791.   % \filbreak%% keeps underfull box messages off when table breaks over pages.
  1792.   % Maybe so, but it also creates really weird page breaks when the table
  1793.   % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
  1794.   % manifests itself, so it can be fixed for real --karl.
  1795.     \global\colcount=0\relax}}%
  1796.   % This preamble sets up a generic column definition, which will
  1797.   % be used as many times as user calls for columns.
  1798.   % \vtop will set a single line and will also let text wrap and
  1799.   % continue for many paragraphs if desired.
  1800.   \halign\bgroup&\global\advance\colcount by 1\relax
  1801.     \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  1802.   % In order to keep entries from bumping into each other
  1803.   % we will add a \leftskip of \multitablecolspace to all columns after
  1804.   % the first one.
  1805.   % If a template has been used, we will add \multitablecolspace
  1806.   % to the width of each template entry.
  1807.   % If the user has set preamble in terms of percent of \hsize we will
  1808.   % use that dimension as the width of the column, and the \leftskip
  1809.   % will keep entries from bumping into each other.  Table will start at
  1810.   % left margin and final column will justify at right margin.
  1811.   % Make sure we don't inherit \rightskip from the outer environment.
  1812.   \rightskip=0pt
  1813.   \ifnum\colcount=1
  1814.     % The first column will be indented with the surrounding text.
  1815.     \advance\hsize by\leftskip
  1816.   \else
  1817.     \ifsetpercent \else
  1818.       % If user has not set preamble in terms of percent of \hsize
  1819.       % we will advance \hsize by \multitablecolspace.
  1820.       \advance\hsize by \multitablecolspace
  1821.     \fi
  1822.    % In either case we will make \leftskip=\multitablecolspace:
  1823.   \leftskip=\multitablecolspace
  1824.   \fi
  1825.   % Ignoring space at the beginning and end avoids an occasional spurious
  1826.   % blank line, when TeX decides to break the line at the space before the
  1827.   % box from the multistrut, so the strut ends up on a line by itself.
  1828.   % For example:
  1829.   % @multitable @columnfractions .11 .89
  1830.   % @item @code{#}
  1831.   % @tab Legal holiday which is valid in major parts of the whole country.
  1832.   % Is automatically provided with highlighting sequences respectively marking
  1833.   % characters.
  1834.   \noindent\ignorespaces##\unskip\multistrut}\cr
  1835. \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
  1836. % If so, do nothing. If not, give it an appropriate dimension based on
  1837. % current baselineskip.
  1838. \ifdim\multitablelinespace=0pt
  1839. %% strut to put in table in case some entry doesn't have descenders,
  1840. %% to keep lines equally spaced
  1841. \let\multistrut = \strut
  1842. %% Test to see if parskip is larger than space between lines of
  1843. %% table. If not, do nothing.
  1844. %%        If so, set to same dimension as multitablelinespace.
  1845. \else
  1846. \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
  1847. width0pt\relax} \fi
  1848. \ifdim\multitableparskip>\multitablelinespace
  1849. \global\multitableparskip=\multitablelinespace
  1850. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  1851.                                       %% than skip between lines in the table.
  1852. \ifdim\multitableparskip=0pt
  1853. \global\multitableparskip=\multitablelinespace
  1854. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  1855.                                       %% than skip between lines in the table.
  1856. \message{indexing,}
  1857. % Index generation facilities
  1858. % Define \newwrite to be identical to plain tex's \newwrite
  1859. % except not \outer, so it can be used within \newindex.
  1860. {\catcode`\@=11
  1861. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1862. % \newindex {foo} defines an index named foo.
  1863. % It automatically defines \fooindex such that
  1864. % \fooindex ...rest of line... puts an entry in the index foo.
  1865. % It also defines \fooindfile to be the number of the output channel for
  1866. % the file that accumulates this index.  The file's extension is foo.
  1867. % The name of an index should be no more than 2 characters long
  1868. % for the sake of vms.
  1869. \def\newindex#1{%
  1870.   \iflinks
  1871.     \expandafter\newwrite \csname#1indfile\endcsname
  1872.     \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
  1873.   \fi
  1874.   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
  1875.     \noexpand\doindex{#1}}
  1876. % @defindex foo  ==  \newindex{foo}
  1877. \def\defindex{\parsearg\newindex}
  1878. % Define @defcodeindex, like @defindex except put all entries in @code.
  1879. \def\newcodeindex#1{%
  1880.   \iflinks
  1881.     \expandafter\newwrite \csname#1indfile\endcsname
  1882.     \openout \csname#1indfile\endcsname \jobname.#1
  1883.   \fi
  1884.   \expandafter\xdef\csname#1index\endcsname{%
  1885.     \noexpand\docodeindex{#1}}
  1886. \def\defcodeindex{\parsearg\newcodeindex}
  1887. % @synindex foo bar    makes index foo feed into index bar.
  1888. % Do this instead of @defindex foo if you don't want it as a separate index.
  1889. % The \closeout helps reduce unnecessary open files; the limit on the
  1890. % Acorn RISC OS is a mere 16 files.
  1891. \def\synindex#1 #2 {%
  1892.   \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1893.   \expandafter\closeout\csname#1indfile\endcsname
  1894.   \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1895.   \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
  1896.     \noexpand\doindex{#2}}%
  1897. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1898. % inside @code.
  1899. \def\syncodeindex#1 #2 {%
  1900.   \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1901.   \expandafter\closeout\csname#1indfile\endcsname
  1902.   \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1903.   \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
  1904.     \noexpand\docodeindex{#2}}%
  1905. % Define \doindex, the driver for all \fooindex macros.
  1906. % Argument #1 is generated by the calling \fooindex macro,
  1907. %  and it is "foo", the name of the index.
  1908. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1909. % This is because \doind is more useful to call from other macros.
  1910. % There is also \dosubind {index}{topic}{subtopic}
  1911. % which makes an entry in a two-level index such as the operation index.
  1912. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1913. \def\singleindexer #1{\doind{\indexname}{#1}}
  1914. % like the previous two, but they put @code around the argument.
  1915. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1916. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1917. \def\indexdummies{%
  1918. \def\ { }%
  1919. % Take care of the plain tex accent commands.
  1920. \def\"{\realbackslash "}%
  1921. \def\`{\realbackslash `}%
  1922. \def\'{\realbackslash '}%
  1923. \def\^{\realbackslash ^}%
  1924. \def\~{\realbackslash ~}%
  1925. \def\={\realbackslash =}%
  1926. \def\b{\realbackslash b}%
  1927. \def\c{\realbackslash c}%
  1928. \def\d{\realbackslash d}%
  1929. \def\u{\realbackslash u}%
  1930. \def\v{\realbackslash v}%
  1931. \def\H{\realbackslash H}%
  1932. % Take care of the plain tex special European modified letters.
  1933. \def\oe{\realbackslash oe}%
  1934. \def\ae{\realbackslash ae}%
  1935. \def\aa{\realbackslash aa}%
  1936. \def\OE{\realbackslash OE}%
  1937. \def\AE{\realbackslash AE}%
  1938. \def\AA{\realbackslash AA}%
  1939. \def\o{\realbackslash o}%
  1940. \def\O{\realbackslash O}%
  1941. \def\l{\realbackslash l}%
  1942. \def\L{\realbackslash L}%
  1943. \def\ss{\realbackslash ss}%
  1944. % Take care of texinfo commands likely to appear in an index entry.
  1945. % (Must be a way to avoid doing expansion at all, and thus not have to
  1946. % laboriously list every single command here.)
  1947. \def\@{@}% will be @@ when we switch to @ as escape char.
  1948. % Need these in case \tex is in effect and \{ is a \delimiter again.
  1949. % But can't use \lbracecmd and \rbracecmd because texindex assumes
  1950. % braces and backslashes are used only as delimiters.
  1951. \let\{ = \mylbrace
  1952. \let\} = \myrbrace
  1953. \def\_{{\realbackslash _}}%
  1954. \def\w{\realbackslash w }%
  1955. \def\bf{\realbackslash bf }%
  1956. %\def\rm{\realbackslash rm }%
  1957. \def\sl{\realbackslash sl }%
  1958. \def\sf{\realbackslash sf}%
  1959. \def\tt{\realbackslash tt}%
  1960. \def\gtr{\realbackslash gtr}%
  1961. \def\less{\realbackslash less}%
  1962. \def\hat{\realbackslash hat}%
  1963. \def\TeX{\realbackslash TeX}%
  1964. \def\dots{\realbackslash dots }%
  1965. \def\result{\realbackslash result}%
  1966. \def\equiv{\realbackslash equiv}%
  1967. \def\expansion{\realbackslash expansion}%
  1968. \def\print{\realbackslash print}%
  1969. \def\error{\realbackslash error}%
  1970. \def\point{\realbackslash point}%
  1971. \def\copyright{\realbackslash copyright}%
  1972. \def\tclose##1{\realbackslash tclose {##1}}%
  1973. \def\code##1{\realbackslash code {##1}}%
  1974. \def\uref##1{\realbackslash uref {##1}}%
  1975. \def\url##1{\realbackslash url {##1}}%
  1976. \def\env##1{\realbackslash env {##1}}%
  1977. \def\command##1{\realbackslash command {##1}}%
  1978. \def\option##1{\realbackslash option {##1}}%
  1979. \def\dotless##1{\realbackslash dotless {##1}}%
  1980. \def\samp##1{\realbackslash samp {##1}}%
  1981. \def\,##1{\realbackslash ,{##1}}%
  1982. \def\t##1{\realbackslash t {##1}}%
  1983. \def\r##1{\realbackslash r {##1}}%
  1984. \def\i##1{\realbackslash i {##1}}%
  1985. \def\b##1{\realbackslash b {##1}}%
  1986. \def\sc##1{\realbackslash sc {##1}}%
  1987. \def\cite##1{\realbackslash cite {##1}}%
  1988. \def\key##1{\realbackslash key {##1}}%
  1989. \def\file##1{\realbackslash file {##1}}%
  1990. \def\var##1{\realbackslash var {##1}}%
  1991. \def\kbd##1{\realbackslash kbd {##1}}%
  1992. \def\dfn##1{\realbackslash dfn {##1}}%
  1993. \def\emph##1{\realbackslash emph {##1}}%
  1994. \def\acronym##1{\realbackslash acronym {##1}}%
  1995. % Handle some cases of @value -- where the variable name does not
  1996. % contain - or _, and the value does not contain any
  1997. % (non-fully-expandable) commands.
  1998. \let\value = \expandablevalue
  1999. \unsepspaces
  2000. % If an index command is used in an @example environment, any spaces
  2001. % therein should become regular spaces in the raw index file, not the
  2002. % expansion of \tie (\\leavevmode \penalty \@M \ ).
  2003. {\obeyspaces
  2004.  \gdef\unsepspaces{\obeyspaces\let =\space}}
  2005. % \indexnofonts no-ops all font-change commands.
  2006. % This is used when outputting the strings to sort the index by.
  2007. \def\indexdummyfont#1{#1}
  2008. \def\indexdummytex{TeX}
  2009. \def\indexdummydots{...}
  2010. \def\indexnofonts{%
  2011. % Just ignore accents.
  2012. \let\,=\indexdummyfont
  2013. \let\"=\indexdummyfont
  2014. \let\`=\indexdummyfont
  2015. \let\'=\indexdummyfont
  2016. \let\^=\indexdummyfont
  2017. \let\~=\indexdummyfont
  2018. \let\==\indexdummyfont
  2019. \let\b=\indexdummyfont
  2020. \let\c=\indexdummyfont
  2021. \let\d=\indexdummyfont
  2022. \let\u=\indexdummyfont
  2023. \let\v=\indexdummyfont
  2024. \let\H=\indexdummyfont
  2025. \let\dotless=\indexdummyfont
  2026. % Take care of the plain tex special European modified letters.
  2027. \def\oe{oe}%
  2028. \def\ae{ae}%
  2029. \def\aa{aa}%
  2030. \def\OE{OE}%
  2031. \def\AE{AE}%
  2032. \def\AA{AA}%
  2033. \def\o{o}%
  2034. \def\O{O}%
  2035. \def\l{l}%
  2036. \def\L{L}%
  2037. \def\ss{ss}%
  2038. \let\w=\indexdummyfont
  2039. \let\t=\indexdummyfont
  2040. \let\r=\indexdummyfont
  2041. \let\i=\indexdummyfont
  2042. \let\b=\indexdummyfont
  2043. \let\emph=\indexdummyfont
  2044. \let\strong=\indexdummyfont
  2045. \let\cite=\indexdummyfont
  2046. \let\sc=\indexdummyfont
  2047. %Don't no-op \tt, since it isn't a user-level command
  2048. % and is used in the definitions of the active chars like <, >, |...
  2049. %\let\tt=\indexdummyfont
  2050. \let\tclose=\indexdummyfont
  2051. \let\code=\indexdummyfont
  2052. \let\url=\indexdummyfont
  2053. \let\uref=\indexdummyfont
  2054. \let\env=\indexdummyfont
  2055. \let\command=\indexdummyfont
  2056. \let\option=\indexdummyfont
  2057. \let\file=\indexdummyfont
  2058. \let\samp=\indexdummyfont
  2059. \let\kbd=\indexdummyfont
  2060. \let\key=\indexdummyfont
  2061. \let\var=\indexdummyfont
  2062. \let\TeX=\indexdummytex
  2063. \let\dots=\indexdummydots
  2064. \def\@{@}%
  2065. % To define \realbackslash, we must make \ not be an escape.
  2066. % We must first make another character (@) an escape
  2067. % so we do not become unable to do a definition.
  2068. {\catcode`\@=0 \catcode`\\=\other
  2069.  @gdef@realbackslash{\}}
  2070. \let\indexbackslash=0  %overridden during \printindex.
  2071. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  2072. % For \ifx comparisons.
  2073. \def\emptymacro{\empty}
  2074. % Most index entries go through here, but \dosubind is the general case.
  2075. \def\doind#1#2{\dosubind{#1}{#2}\empty}
  2076. % Workhorse for all \fooindexes.
  2077. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  2078. % \empty if called from \doind, as we usually are.  The main exception
  2079. % is with defuns, which call us directly.
  2080. \def\dosubind#1#2#3{%
  2081.   % Put the index entry in the margin if desired.
  2082.   \ifx\SETmarginindex\relax\else
  2083.     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
  2084.   \fi
  2085.     \count255=\lastpenalty
  2086.     {%
  2087.       \indexdummies % Must do this here, since \bf, etc expand at this stage
  2088.       \escapechar=`\\
  2089.       {%
  2090.         \let\folio = 0% We will expand all macros now EXCEPT \folio.
  2091.         \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  2092.         % so it will be output as is; and it will print as backslash.
  2093.         %
  2094.         \def\thirdarg{#3}%
  2095.         %
  2096.         % If third arg is present, precede it with space in sort key.
  2097.         \ifx\thirdarg\emptymacro
  2098.           \let\subentry = \empty
  2099.         \else
  2100.           \def\subentry{ #3}%
  2101.         \fi
  2102.         %
  2103.         % First process the index-string with all font commands turned off
  2104.         % to get the string to sort by.
  2105.         {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
  2106.         %
  2107.         % Now produce the complete index entry, with both the sort key and the
  2108.         % original text, including any font commands.
  2109.         \toks0 = {#2}%
  2110.         \edef\temp{%
  2111.           \write\csname#1indfile\endcsname{%
  2112.             \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
  2113.         }%
  2114.         %
  2115.         % If third (subentry) arg is present, add it to the index string.
  2116.         \ifx\thirdarg\emptymacro \else
  2117.           \toks0 = {#3}%
  2118.           \edef\temp{\temp{\the\toks0}}%
  2119.         \fi
  2120.         %
  2121.         % If a skip is the last thing on the list now, preserve it
  2122.         % by backing up by \lastskip, doing the \write, then inserting
  2123.         % the skip again.  Otherwise, the whatsit generated by the
  2124.         % \write will make \lastskip zero.  The result is that sequences
  2125.         % like this:
  2126.         % @end defun
  2127.         % @tindex whatever
  2128.         % @defun ...
  2129.         % will have extra space inserted, because the \medbreak in the
  2130.         % start of the @defun won't see the skip inserted by the @end of
  2131.         % the previous defun.
  2132.         % 
  2133.         % But don't do any of this if we're not in vertical mode.  We
  2134.         % don't want to do a \vskip and prematurely end a paragraph.
  2135.         % 
  2136.         % Avoid page breaks due to these extra skips, too.
  2137.         % 
  2138.         \iflinks
  2139.           \ifvmode
  2140.             \skip0 = \lastskip
  2141.             \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
  2142.           \fi
  2143.           %
  2144.           \temp % do the write
  2145.           %
  2146.           % 
  2147.           \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
  2148.         \fi
  2149.       }%
  2150.     }%
  2151.     \penalty\count255
  2152. % The index entry written in the file actually looks like
  2153. %  \entry {sortstring}{page}{topic}
  2154. %  \entry {sortstring}{page}{topic}{subtopic}
  2155. % The texindex program reads in these files and writes files
  2156. % containing these kinds of lines:
  2157. %  \initial {c}
  2158. %     before the first topic whose initial is c
  2159. %  \entry {topic}{pagelist}
  2160. %     for a topic that is used without subtopics
  2161. %  \primary {topic}
  2162. %     for the beginning of a topic that is used with subtopics
  2163. %  \secondary {subtopic}{pagelist}
  2164. %     for each subtopic.
  2165. % Define the user-accessible indexing commands
  2166. % @findex, @vindex, @kindex, @cindex.
  2167. \def\findex {\fnindex}
  2168. \def\kindex {\kyindex}
  2169. \def\cindex {\cpindex}
  2170. \def\vindex {\vrindex}
  2171. \def\tindex {\tpindex}
  2172. \def\pindex {\pgindex}
  2173. \def\cindexsub {\begingroup\obeylines\cindexsub}
  2174. {\obeylines %
  2175. \gdef\cindexsub "#1" #2^^M{\endgroup %
  2176. \dosubind{cp}{#2}{#1}}}
  2177. % Define the macros used in formatting output of the sorted index material.
  2178. % @printindex causes a particular index (the ??s file) to get printed.
  2179. % It does not print any chapter heading (usually an @unnumbered).
  2180. \def\printindex{\parsearg\doprintindex}
  2181. \def\doprintindex#1{\begingroup
  2182.   \dobreak \chapheadingskip{10000}%
  2183.   \indexfonts \rm
  2184.   \tolerance = 9500
  2185.   \indexbreaks
  2186.   % See if the index file exists and is nonempty.
  2187.   % Change catcode of @ here so that if the index file contains
  2188.   % \initial {@}
  2189.   % as its first line, TeX doesn't complain about mismatched braces
  2190.   % (because it thinks @} is a control sequence).
  2191.   \catcode`\@ = 11
  2192.   \openin 1 \jobname.#1s
  2193.   \ifeof 1
  2194.     % \enddoublecolumns gets confused if there is no text in the index,
  2195.     % and it loses the chapter title and the aux file entries for the
  2196.     % index.  The easiest way to prevent this problem is to make sure
  2197.     % there is some text.
  2198.     (Index is nonexistent)
  2199.   \else
  2200.     %
  2201.     % If the index file exists but is empty, then \openin leaves \ifeof
  2202.     % false.  We have to make TeX try to read something from the file, so
  2203.     % it can discover if there is anything in it.
  2204.     \read 1 to \temp
  2205.     \ifeof 1
  2206.       (Index is empty)
  2207.     \else
  2208.       % Index files are almost Texinfo source, but we use \ as the escape
  2209.       % character.  It would be better to use @, but that's too big a change
  2210.       % to make right now.
  2211.       \def\indexbackslash{\rawbackslashxx}%
  2212.       \catcode`\\ = 0
  2213.       \escapechar = `\\
  2214.       \begindoublecolumns
  2215.       \input \jobname.#1s
  2216.       \enddoublecolumns
  2217.     \fi
  2218.   \fi
  2219.   \closein 1
  2220. \endgroup}
  2221. % These macros are used by the sorted index file itself.
  2222. % Change them to control the appearance of the index.
  2223. \def\initial#1{{%
  2224.   % Some minor font changes for the special characters.
  2225.   \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  2226.   % Remove any glue we may have, we'll be inserting our own.
  2227.   \removelastskip
  2228.   % We like breaks before the index initials, so insert a bonus.
  2229.   \penalty -300
  2230.   % Typeset the initial.  Making this add up to a whole number of
  2231.   % baselineskips increases the chance of the dots lining up from column
  2232.   % to column.  It still won't often be perfect, because of the stretch
  2233.   % we need before each entry, but it's better.
  2234.   % No shrink because it confuses \balancecolumns.
  2235.   \vskip 1.67\baselineskip plus .5\baselineskip
  2236.   \leftline{\secbf #1}%
  2237.   \vskip .33\baselineskip plus .1\baselineskip
  2238.   % Do our best not to break after the initial.
  2239.   \nobreak
  2240. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  2241. % flush to the right margin.  It is used for index and table of contents
  2242. % entries.  The paragraph is indented by \leftskip.
  2243. \def\entry#1#2{\begingroup
  2244.   % Start a new paragraph if necessary, so our assignments below can't
  2245.   % affect previous text.
  2246.   \par
  2247.   % Do not fill out the last line with white space.
  2248.   \parfillskip = 0in
  2249.   % No extra space above this paragraph.
  2250.   \parskip = 0in
  2251.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  2252.   \finalhyphendemerits = 0
  2253.   % \hangindent is only relevant when the entry text and page number
  2254.   % don't both fit on one line.  In that case, bob suggests starting the
  2255.   % dots pretty far over on the line.  Unfortunately, a large
  2256.   % indentation looks wrong when the entry text itself is broken across
  2257.   % lines.  So we use a small indentation and put up with long leaders.
  2258.   % \hangafter is reset to 1 (which is the value we want) at the start
  2259.   % of each paragraph, so we need not do anything with that.
  2260.   \hangindent = 2em
  2261.   % When the entry text needs to be broken, just fill out the first line
  2262.   % with blank space.
  2263.   \rightskip = 0pt plus1fil
  2264.   % A bit of stretch before each entry for the benefit of balancing columns.
  2265.   \vskip 0pt plus1pt
  2266.   % Start a ``paragraph'' for the index entry so the line breaking
  2267.   % parameters we've set above will have an effect.
  2268.   \noindent
  2269.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  2270.   #1%
  2271.   % The following is kludged to not output a line of dots in the index if
  2272.   % there are no page numbers.  The next person who breaks this will be
  2273.   % cursed by a Unix daemon.
  2274.   \def\tempa{{\rm }}%
  2275.   \def\tempb{#2}%
  2276.   \edef\tempc{\tempa}%
  2277.   \edef\tempd{\tempb}%
  2278.   \ifx\tempc\tempd\ \else%
  2279.     %
  2280.     % If we must, put the page number on a line of its own, and fill out
  2281.     % this line with blank space.  (The \hfil is overwhelmed with the
  2282.     % fill leaders glue in \indexdotfill if the page number does fit.)
  2283.     \hfil\penalty50
  2284.     \null\nobreak\indexdotfill % Have leaders before the page number.
  2285.     %
  2286.     % The `\ ' here is removed by the implicit \unskip that TeX does as
  2287.     % part of (the primitive) \par.  Without it, a spurious underfull
  2288.     % \hbox ensues.
  2289.     \ #2% The page number ends the paragraph.
  2290.   \fi%
  2291.   \par
  2292. \endgroup}
  2293. % Like \dotfill except takes at least 1 em.
  2294. \def\indexdotfill{\cleaders
  2295.   \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  2296. \def\primary #1{\line{#1\hfil}}
  2297. \newskip\secondaryindent \secondaryindent=0.5cm
  2298. \def\secondary #1#2{
  2299. {\parfillskip=0in \parskip=0in
  2300. \hangindent =1in \hangafter=1
  2301. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  2302. % Define two-column mode, which we use to typeset indexes.
  2303. % Adapted from the TeXbook, page 416, which is to say,
  2304. % the manmac.tex format used to print the TeXbook itself.
  2305. \catcode`\@=11
  2306. \newbox\partialpage
  2307. \newdimen\doublecolumnhsize
  2308. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  2309.   % Grab any single-column material above us.
  2310.   \output = {\global\setbox\partialpage = \vbox{%
  2311.     % 
  2312.     % Here is a possibility not foreseen in manmac: if we accumulate a
  2313.     % whole lot of material, we might end up calling this \output
  2314.     % routine twice in a row (see the doublecol-lose test, which is
  2315.     % essentially a couple of indexes with @setchapternewpage off).  In
  2316.     % that case, we must prevent the second \partialpage from
  2317.     % simply overwriting the first, causing us to lose the page.
  2318.     % This will preserve it until a real output routine can ship it
  2319.     % out.  Generally, \partialpage will be empty when this runs and
  2320.     % this will be a no-op.
  2321.     \unvbox\partialpage
  2322.     %
  2323.     % Unvbox the main output page.
  2324.     \unvbox255
  2325.     \kern-\topskip \kern\baselineskip
  2326.   }}%
  2327.   \eject % run that output routine to set \partialpage
  2328.   % Use the double-column output routine for subsequent pages.
  2329.   \output = {\doublecolumnout}%
  2330.   % Change the page size parameters.  We could do this once outside this
  2331.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  2332.   % format, but then we repeat the same computation.  Repeating a couple
  2333.   % of assignments once per index is clearly meaningless for the
  2334.   % execution time, so we may as well do it in one place.
  2335.   % First we halve the line length, less a little for the gutter between
  2336.   % the columns.  We compute the gutter based on the line length, so it
  2337.   % changes automatically with the paper format.  The magic constant
  2338.   % below is chosen so that the gutter has the same value (well, +-<1pt)
  2339.   % as it did when we hard-coded it.
  2340.   % We put the result in a separate register, \doublecolumhsize, so we
  2341.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  2342.   % been clobbered.
  2343.   \doublecolumnhsize = \hsize
  2344.     \advance\doublecolumnhsize by -.04154\hsize
  2345.     \divide\doublecolumnhsize by 2
  2346.   \hsize = \doublecolumnhsize
  2347.   % Double the \vsize as well.  (We don't need a separate register here,
  2348.   % since nobody clobbers \vsize.)
  2349.   \advance\vsize by -\ht\partialpage
  2350.   \vsize = 2\vsize
  2351. % The double-column output routine for all double-column pages except
  2352. % the last.
  2353. \def\doublecolumnout{%
  2354.   \splittopskip=\topskip \splitmaxdepth=\maxdepth
  2355.   % Get the available space for the double columns -- the normal
  2356.   % (undoubled) page height minus any material left over from the
  2357.   % previous page.
  2358.   \dimen@ = \vsize
  2359.   \divide\dimen@ by 2
  2360.   % box0 will be the left-hand column, box2 the right.
  2361.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  2362.   \onepageout\pagesofar
  2363.   \unvbox255
  2364.   \penalty\outputpenalty
  2365. \def\pagesofar{%
  2366.   % Re-output the contents of the output page -- any previous material,
  2367.   % followed by the two boxes we just split, in box0 and box2.
  2368.   \advance\vsize by \ht\partialpage
  2369.   \unvbox\partialpage
  2370.   \hsize = \doublecolumnhsize
  2371.   \wd0=\hsize \wd2=\hsize
  2372.   \hbox to\pagewidth{\box0\hfil\box2}%
  2373. \def\enddoublecolumns{%
  2374.   \output = {%
  2375.     % Split the last of the double-column material.  Leave it on the
  2376.     % current page, no automatic page break.
  2377.     \balancecolumns
  2378.     %
  2379.     % If we end up splitting too much material for the current page,
  2380.     % though, there will be another page break right after this \output
  2381.     % invocation ends.  Having called \balancecolumns once, we do not
  2382.     % want to call it again.  Therefore, reset \output to its normal
  2383.     % definition right away.  (We hope \balancecolumns will never be
  2384.     % called on to balance too much material, but if it is, this makes
  2385.     % the output somewhat more palatable.)
  2386.     \global\output = {\onepageout{\pagecontents\PAGE}}%
  2387.   \eject
  2388.   \endgroup % started in \begindoublecolumns
  2389.   % \pagegoal was set to the doubled \vsize above, since we restarted
  2390.   % the current page.  We're now back to normal single-column
  2391.   % typesetting, so reset \pagegoal to the normal \vsize (after the
  2392.   % \endgroup where \vsize got restored).
  2393.   \pagegoal = \vsize
  2394. \def\balancecolumns{%
  2395.   % Called at the end of the double column material.
  2396.   \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
  2397.   \dimen@ = \ht0
  2398.   \advance\dimen@ by \topskip
  2399.   \advance\dimen@ by-\baselineskip
  2400.   \divide\dimen@ by 2 % target to split to
  2401.   %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
  2402.   \splittopskip = \topskip
  2403.   % Loop until we get a decent breakpoint.
  2404.     \vbadness = 10000
  2405.     \loop
  2406.       \global\setbox3 = \copy0
  2407.       \global\setbox1 = \vsplit3 to \dimen@
  2408.     \ifdim\ht3>\dimen@
  2409.       \global\advance\dimen@ by 1pt
  2410.     \repeat
  2411.   %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
  2412.   \setbox0=\vbox to\dimen@{\unvbox1}%
  2413.   \setbox2=\vbox to\dimen@{\unvbox3}%
  2414.   \pagesofar
  2415. \catcode`\@ = \other
  2416. \message{sectioning,}
  2417. % Define chapters, sections, etc.
  2418. \newcount\chapno
  2419. \newcount\secno        \secno=0
  2420. \newcount\subsecno     \subsecno=0
  2421. \newcount\subsubsecno  \subsubsecno=0
  2422. % This counter is funny since it counts through charcodes of letters A, B, ...
  2423. \newcount\appendixno  \appendixno = `\@
  2424. \def\appendixletter{\char\the\appendixno}
  2425. % Each @chapter defines this as the name of the chapter.
  2426. % page headings and footings can use it.  @section does likewise.
  2427. \def\thischapter{}
  2428. \def\thissection{}
  2429. \newcount\absseclevel % used to calculate proper heading level
  2430. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  2431. % @raisesections: treat @section as chapter, @subsection as section, etc.
  2432. \def\raisesections{\global\advance\secbase by -1}
  2433. \let\up=\raisesections % original BFox name
  2434. % @lowersections: treat @chapter as section, @section as subsection, etc.
  2435. \def\lowersections{\global\advance\secbase by 1}
  2436. \let\down=\lowersections % original BFox name
  2437. % Choose a numbered-heading macro
  2438. % #1 is heading level if unmodified by @raisesections or @lowersections
  2439. % #2 is text for heading
  2440. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2441. \ifcase\absseclevel
  2442.   \chapterzzz{#2}
  2443.   \seczzz{#2}
  2444.   \numberedsubseczzz{#2}
  2445.   \numberedsubsubseczzz{#2}
  2446. \else
  2447.   \ifnum \absseclevel<0
  2448.     \chapterzzz{#2}
  2449.   \else
  2450.     \numberedsubsubseczzz{#2}
  2451.   \fi
  2452. % like \numhead, but chooses appendix heading levels
  2453. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2454. \ifcase\absseclevel
  2455.   \appendixzzz{#2}
  2456.   \appendixsectionzzz{#2}
  2457.   \appendixsubseczzz{#2}
  2458.   \appendixsubsubseczzz{#2}
  2459. \else
  2460.   \ifnum \absseclevel<0
  2461.     \appendixzzz{#2}
  2462.   \else
  2463.     \appendixsubsubseczzz{#2}
  2464.   \fi
  2465. % like \numhead, but chooses numberless heading levels
  2466. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2467. \ifcase\absseclevel
  2468.   \unnumberedzzz{#2}
  2469.   \unnumberedseczzz{#2}
  2470.   \unnumberedsubseczzz{#2}
  2471.   \unnumberedsubsubseczzz{#2}
  2472. \else
  2473.   \ifnum \absseclevel<0
  2474.     \unnumberedzzz{#2}
  2475.   \else
  2476.     \unnumberedsubsubseczzz{#2}
  2477.   \fi
  2478. % @chapter, @appendix, @unnumbered.
  2479. \def\thischaptername{No Chapter Title}
  2480. \outer\def\chapter{\parsearg\chapteryyy}
  2481. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  2482. \def\chapterzzz #1{%
  2483. \secno=0 \subsecno=0 \subsubsecno=0
  2484. \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
  2485. \chapmacro {#1}{\the\chapno}%
  2486. \gdef\thissection{#1}%
  2487. \gdef\thischaptername{#1}%
  2488. % We don't substitute the actual chapter name into \thischapter
  2489. % because we don't want its macros evaluated now.
  2490. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  2491. \toks0 = {#1}%
  2492. \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
  2493.                                   {\the\chapno}}}%
  2494. \temp
  2495. \donoderef
  2496. \global\let\section = \numberedsec
  2497. \global\let\subsection = \numberedsubsec
  2498. \global\let\subsubsection = \numberedsubsubsec
  2499. \outer\def\appendix{\parsearg\appendixyyy}
  2500. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  2501. \def\appendixzzz #1{%
  2502. \secno=0 \subsecno=0 \subsubsecno=0
  2503. \global\advance \appendixno by 1
  2504. \message{\putwordAppendix\space \appendixletter}%
  2505. \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
  2506. \gdef\thissection{#1}%
  2507. \gdef\thischaptername{#1}%
  2508. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  2509. \toks0 = {#1}%
  2510. \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
  2511.                        {\putwordAppendix{} \appendixletter}}}%
  2512. \temp
  2513. \appendixnoderef
  2514. \global\let\section = \appendixsec
  2515. \global\let\subsection = \appendixsubsec
  2516. \global\let\subsubsection = \appendixsubsubsec
  2517. % @centerchap is like @unnumbered, but the heading is centered.
  2518. \outer\def\centerchap{\parsearg\centerchapyyy}
  2519. \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
  2520. % @top is like @unnumbered.
  2521. \outer\def\top{\parsearg\unnumberedyyy}
  2522. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  2523. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  2524. \def\unnumberedzzz #1{%
  2525. \secno=0 \subsecno=0 \subsubsecno=0
  2526. % This used to be simply \message{#1}, but TeX fully expands the
  2527. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  2528. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  2529. % expanded @cite (which turns out to cause errors because \cite is meant
  2530. % to be executed, not expanded).
  2531. % Anyway, we don't want the fully-expanded definition of @cite to appear
  2532. % as a result of the \message, we just want `@cite' itself.  We use
  2533. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  2534. % simply yielding the contents of <toks register>.  (We also do this for
  2535. % the toc entries.)
  2536. \toks0 = {#1}\message{(\the\toks0)}%
  2537. \unnumbchapmacro {#1}%
  2538. \gdef\thischapter{#1}\gdef\thissection{#1}%
  2539. \toks0 = {#1}%
  2540. \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
  2541. \temp
  2542. \unnumbnoderef
  2543. \global\let\section = \unnumberedsec
  2544. \global\let\subsection = \unnumberedsubsec
  2545. \global\let\subsubsection = \unnumberedsubsubsec
  2546. % Sections.
  2547. \outer\def\numberedsec{\parsearg\secyyy}
  2548. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  2549. \def\seczzz #1{%
  2550. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2551. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  2552. \toks0 = {#1}%
  2553. \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
  2554.                                   {\the\chapno}{\the\secno}}}%
  2555. \temp
  2556. \donoderef
  2557. \nobreak
  2558. \outer\def\appendixsection{\parsearg\appendixsecyyy}
  2559. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  2560. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  2561. \def\appendixsectionzzz #1{%
  2562. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2563. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  2564. \toks0 = {#1}%
  2565. \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
  2566.                                   {\appendixletter}{\the\secno}}}%
  2567. \temp
  2568. \appendixnoderef
  2569. \nobreak
  2570. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  2571. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  2572. \def\unnumberedseczzz #1{%
  2573. \plainsecheading {#1}\gdef\thissection{#1}%
  2574. \toks0 = {#1}%
  2575. \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
  2576. \temp
  2577. \unnumbnoderef
  2578. \nobreak
  2579. % Subsections.
  2580. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  2581. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  2582. \def\numberedsubseczzz #1{%
  2583. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2584. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  2585. \toks0 = {#1}%
  2586. \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
  2587.                                     {\the\chapno}{\the\secno}{\the\subsecno}}}%
  2588. \temp
  2589. \donoderef
  2590. \nobreak
  2591. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  2592. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  2593. \def\appendixsubseczzz #1{%
  2594. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2595. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  2596. \toks0 = {#1}%
  2597. \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
  2598.                                 {\appendixletter}{\the\secno}{\the\subsecno}}}%
  2599. \temp
  2600. \appendixnoderef
  2601. \nobreak
  2602. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  2603. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  2604. \def\unnumberedsubseczzz #1{%
  2605. \plainsubsecheading {#1}\gdef\thissection{#1}%
  2606. \toks0 = {#1}%
  2607. \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
  2608.                                     {\the\toks0}}}%
  2609. \temp
  2610. \unnumbnoderef
  2611. \nobreak
  2612. % Subsubsections.
  2613. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  2614. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  2615. \def\numberedsubsubseczzz #1{%
  2616. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2617. \subsubsecheading {#1}
  2618.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2619. \toks0 = {#1}%
  2620. \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
  2621.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
  2622. \temp
  2623. \donoderef
  2624. \nobreak
  2625. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  2626. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  2627. \def\appendixsubsubseczzz #1{%
  2628. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2629. \subsubsecheading {#1}
  2630.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2631. \toks0 = {#1}%
  2632. \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
  2633.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
  2634. \temp
  2635. \appendixnoderef
  2636. \nobreak
  2637. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  2638. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  2639. \def\unnumberedsubsubseczzz #1{%
  2640. \plainsubsubsecheading {#1}\gdef\thissection{#1}%
  2641. \toks0 = {#1}%
  2642. \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
  2643.                                     {\the\toks0}}}%
  2644. \temp
  2645. \unnumbnoderef
  2646. \nobreak
  2647. % These are variants which are not "outer", so they can appear in @ifinfo.
  2648. % Actually, they should now be obsolete; ordinary section commands should work.
  2649. \def\infotop{\parsearg\unnumberedzzz}
  2650. \def\infounnumbered{\parsearg\unnumberedzzz}
  2651. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  2652. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  2653. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  2654. \def\infoappendix{\parsearg\appendixzzz}
  2655. \def\infoappendixsec{\parsearg\appendixseczzz}
  2656. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  2657. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  2658. \def\infochapter{\parsearg\chapterzzz}
  2659. \def\infosection{\parsearg\sectionzzz}
  2660. \def\infosubsection{\parsearg\subsectionzzz}
  2661. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  2662. % These macros control what the section commands do, according
  2663. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  2664. % Define them by default for a numbered chapter.
  2665. \global\let\section = \numberedsec
  2666. \global\let\subsection = \numberedsubsec
  2667. \global\let\subsubsection = \numberedsubsubsec
  2668. % Define @majorheading, @heading and @subheading
  2669. % NOTE on use of \vbox for chapter headings, section headings, and such:
  2670. %       1) We use \vbox rather than the earlier \line to permit
  2671. %          overlong headings to fold.
  2672. %       2) \hyphenpenalty is set to 10000 because hyphenation in a
  2673. %          heading is obnoxious; this forbids it.
  2674. %       3) Likewise, headings look best if no \parindent is used, and
  2675. %          if justification is not attempted.  Hence \raggedright.
  2676. \def\majorheading{\parsearg\majorheadingzzz}
  2677. \def\majorheadingzzz #1{%
  2678. {\advance\chapheadingskip by 10pt \chapbreak }%
  2679. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2680.                   \parindent=0pt\raggedright
  2681.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2682. \def\chapheading{\parsearg\chapheadingzzz}
  2683. \def\chapheadingzzz #1{\chapbreak %
  2684. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2685.                   \parindent=0pt\raggedright
  2686.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2687. % @heading, @subheading, @subsubheading.
  2688. \def\heading{\parsearg\plainsecheading}
  2689. \def\subheading{\parsearg\plainsubsecheading}
  2690. \def\subsubheading{\parsearg\plainsubsubsecheading}
  2691. % These macros generate a chapter, section, etc. heading only
  2692. % (including whitespace, linebreaking, etc. around it),
  2693. % given all the information in convenient, parsed form.
  2694. %%% Args are the skip and penalty (usually negative)
  2695. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  2696. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  2697. %%% Define plain chapter starts, and page on/off switching for it
  2698. % Parameter controlling skip before chapter headings (if needed)
  2699. \newskip\chapheadingskip
  2700. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  2701. \def\chappager{\par\vfill\supereject}
  2702. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  2703. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  2704. \def\CHAPPAGoff{%
  2705. \global\let\contentsalignmacro = \chappager
  2706. \global\let\pchapsepmacro=\chapbreak
  2707. \global\let\pagealignmacro=\chappager}
  2708. \def\CHAPPAGon{%
  2709. \global\let\contentsalignmacro = \chappager
  2710. \global\let\pchapsepmacro=\chappager
  2711. \global\let\pagealignmacro=\chappager
  2712. \global\def\HEADINGSon{\HEADINGSsingle}}
  2713. \def\CHAPPAGodd{
  2714. \global\let\contentsalignmacro = \chapoddpage
  2715. \global\let\pchapsepmacro=\chapoddpage
  2716. \global\let\pagealignmacro=\chapoddpage
  2717. \global\def\HEADINGSon{\HEADINGSdouble}}
  2718. \CHAPPAGon
  2719. \def\CHAPFplain{
  2720. \global\let\chapmacro=\chfplain
  2721. \global\let\unnumbchapmacro=\unnchfplain
  2722. \global\let\centerchapmacro=\centerchfplain}
  2723. % Plain chapter opening.
  2724. % #1 is the text, #2 the chapter number or empty if unnumbered.
  2725. \def\chfplain#1#2{%
  2726.   \pchapsepmacro
  2727.     \chapfonts \rm
  2728.     \def\chapnum{#2}%
  2729.     \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
  2730.     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  2731.           \hangindent = \wd0 \centerparametersmaybe
  2732.           \unhbox0 #1\par}%
  2733.   \nobreak\bigskip % no page break after a chapter title
  2734.   \nobreak
  2735. % Plain opening for unnumbered.
  2736. \def\unnchfplain#1{\chfplain{#1}{}}
  2737. % @centerchap -- centered and unnumbered.
  2738. \let\centerparametersmaybe = \relax
  2739. \def\centerchfplain#1{{%
  2740.   \def\centerparametersmaybe{%
  2741.     \advance\rightskip by 3\rightskip
  2742.     \leftskip = \rightskip
  2743.     \parfillskip = 0pt
  2744.   \chfplain{#1}{}%
  2745. \CHAPFplain % The default
  2746. \def\unnchfopen #1{%
  2747. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2748.                        \parindent=0pt\raggedright
  2749.                        \rm #1\hfill}}\bigskip \par\nobreak
  2750. \def\chfopen #1#2{\chapoddpage {\chapfonts
  2751. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  2752. \par\penalty 5000 %
  2753. \def\centerchfopen #1{%
  2754. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2755.                        \parindent=0pt
  2756.                        \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
  2757. \def\CHAPFopen{
  2758. \global\let\chapmacro=\chfopen
  2759. \global\let\unnumbchapmacro=\unnchfopen
  2760. \global\let\centerchapmacro=\centerchfopen}
  2761. % Section titles.
  2762. \newskip\secheadingskip
  2763. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2764. \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
  2765. \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
  2766. % Subsection titles.
  2767. \newskip \subsecheadingskip
  2768. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  2769. \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
  2770. \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
  2771. % Subsubsection titles.
  2772. \let\subsubsecheadingskip = \subsecheadingskip
  2773. \let\subsubsecheadingbreak = \subsecheadingbreak
  2774. \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
  2775. \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
  2776. % Print any size section title.
  2777. % #1 is the section type (sec/subsec/subsubsec), #2 is the section
  2778. % number (maybe empty), #3 the text.
  2779. \def\sectionheading#1#2#3{%
  2780.     \expandafter\advance\csname #1headingskip\endcsname by \parskip
  2781.     \csname #1headingbreak\endcsname
  2782.     % Switch to the right set of fonts.
  2783.     \csname #1fonts\endcsname \rm
  2784.     %
  2785.     % Only insert the separating space if we have a section number.
  2786.     \def\secnum{#2}%
  2787.     \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
  2788.     %
  2789.     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  2790.           \hangindent = \wd0 % zero if no section number
  2791.           \unhbox0 #3}%
  2792.   \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
  2793. \message{toc,}
  2794. \newwrite\tocfile
  2795. % Write an entry to the toc file, opening it if necessary.
  2796. % Called from @chapter, etc.  We supply {\folio} at the end of the
  2797. % argument, which will end up as the last argument to the \...entry macro.
  2798. % We open the .toc file here instead of at @setfilename or any other
  2799. % given time so that @contents can be put in the document anywhere.
  2800. \newif\iftocfileopened
  2801. \def\writetocentry#1{%
  2802.   \iftocfileopened\else
  2803.     \immediate\openout\tocfile = \jobname.toc
  2804.     \global\tocfileopenedtrue
  2805.   \fi
  2806.   \iflinks \write\tocfile{#1{\folio}}\fi
  2807. \newskip\contentsrightmargin \contentsrightmargin=1in
  2808. \newcount\savepageno
  2809. \newcount\lastnegativepageno \lastnegativepageno = -1
  2810. % Finish up the main text and prepare to read what we've written
  2811. % to \tocfile.
  2812. \def\startcontents#1{%
  2813.    % If @setchapternewpage on, and @headings double, the contents should
  2814.    % start on an odd page, unlike chapters.  Thus, we maintain
  2815.    % \contentsalignmacro in parallel with \pagealignmacro.
  2816.    % From: Torbjorn Granlund <tege@matematik.su.se>
  2817.    \contentsalignmacro
  2818.    \immediate\closeout\tocfile
  2819.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2820.    % It is abundantly clear what they are.
  2821.    \unnumbchapmacro{#1}\def\thischapter{}%
  2822.    \savepageno = \pageno
  2823.    \begingroup                  % Set up to handle contents files properly.
  2824.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2825.       % We can't do this, because then an actual ^ in a section
  2826.       % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
  2827.       %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  2828.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2829.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2830.       %
  2831.       % Roman numerals for page numbers.
  2832.       \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
  2833. % Normal (long) toc.
  2834. \def\contents{%
  2835.    \startcontents{\putwordTableofContents}%
  2836.      \openin 1 \jobname.toc
  2837.      \ifeof 1 \else
  2838.        \closein 1
  2839.        \input \jobname.toc
  2840.      \fi
  2841.      \vfill \eject
  2842.    \endgroup
  2843.    \lastnegativepageno = \pageno
  2844.    \pageno = \savepageno
  2845. % And just the chapters.
  2846. \def\summarycontents{%
  2847.    \startcontents{\putwordShortContents}%
  2848.       %
  2849.       \let\chapentry = \shortchapentry
  2850.       \let\unnumbchapentry = \shortunnumberedentry
  2851.       % We want a true roman here for the page numbers.
  2852.       \secfonts
  2853.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2854.       \rm
  2855.       \hyphenpenalty = 10000
  2856.       \advance\baselineskip by 1pt % Open it up a little.
  2857.       \def\secentry ##1##2##3##4{}
  2858.       \def\unnumbsecentry ##1##2{}
  2859.       \def\subsecentry ##1##2##3##4##5{}
  2860.       \def\unnumbsubsecentry ##1##2{}
  2861.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2862.       \def\unnumbsubsubsecentry ##1##2{}
  2863.       \openin 1 \jobname.toc
  2864.       \ifeof 1 \else
  2865.         \closein 1
  2866.         \input \jobname.toc
  2867.       \fi
  2868.      \vfill \eject
  2869.    \endgroup
  2870.    \lastnegativepageno = \pageno
  2871.    \pageno = \savepageno
  2872. \let\shortcontents = \summarycontents
  2873. % These macros generate individual entries in the table of contents.
  2874. % The first argument is the chapter or section name.
  2875. % The last argument is the page number.
  2876. % The arguments in between are the chapter number, section number, ...
  2877. % Chapter-level things, for both the long and short contents.
  2878. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2879. % See comments in \dochapentry re vbox and related settings
  2880. \def\shortchapentry#1#2#3{%
  2881.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2882. % Typeset the label for a chapter or appendix for the short contents.
  2883. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2884. % We could simplify the code here by writing out an \appendixentry
  2885. % command in the toc file for appendices, instead of using \chapentry
  2886. % for both, but it doesn't seem worth it.
  2887. \setbox0 = \hbox{\shortcontrm \putwordAppendix }
  2888. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2889. \def\shortchaplabel#1{%
  2890.   % We typeset #1 in a box of constant width, regardless of the text of
  2891.   % #1, so the chapter titles will come out aligned.
  2892.   \setbox0 = \hbox{#1}%
  2893.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2894.   % This space should be plenty, since a single number is .5em, and the
  2895.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2896.   % (This space doesn't include the extra space that gets added after
  2897.   % the label; that gets put in by \shortchapentry above.)
  2898.   \advance\dimen0 by 1.1em
  2899.   \hbox to \dimen0{#1\hfil}%
  2900. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2901. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2902. % Sections.
  2903. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2904. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2905. % Subsections.
  2906. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2907. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2908. % And subsubsections.
  2909. \def\subsubsecentry#1#2#3#4#5#6{%
  2910.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2911. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2912. % This parameter controls the indentation of the various levels.
  2913. \newdimen\tocindent \tocindent = 3pc
  2914. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2915. % page number.
  2916. % If the toc has to be broken over pages, we want it to be at chapters
  2917. % if at all possible; hence the \penalty.
  2918. \def\dochapentry#1#2{%
  2919.    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  2920.    \begingroup
  2921.      \chapentryfonts
  2922.      \tocentry{#1}{\dopageno{#2}}%
  2923.    \endgroup
  2924.    \nobreak\vskip .25\baselineskip plus.1\baselineskip
  2925. \def\dosecentry#1#2{\begingroup
  2926.   \secentryfonts \leftskip=\tocindent
  2927.   \tocentry{#1}{\dopageno{#2}}%
  2928. \endgroup}
  2929. \def\dosubsecentry#1#2{\begingroup
  2930.   \subsecentryfonts \leftskip=2\tocindent
  2931.   \tocentry{#1}{\dopageno{#2}}%
  2932. \endgroup}
  2933. \def\dosubsubsecentry#1#2{\begingroup
  2934.   \subsubsecentryfonts \leftskip=3\tocindent
  2935.   \tocentry{#1}{\dopageno{#2}}%
  2936. \endgroup}
  2937. % Final typesetting of a toc entry; we use the same \entry macro as for
  2938. % the index entries, but we want to suppress hyphenation here.  (We
  2939. % can't do that in the \entry macro, since index entries might consist
  2940. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2941. \def\tocentry#1#2{\begingroup
  2942.   \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
  2943.   % Do not use \turnoffactive in these arguments.  Since the toc is
  2944.   % typeset in cmr, so characters such as _ would come out wrong; we
  2945.   % have to do the usual translation tricks.
  2946.   \entry{#1}{#2}%
  2947. \endgroup}
  2948. % Space between chapter (or whatever) number and the title.
  2949. \def\labelspace{\hskip1em \relax}
  2950. \def\dopageno#1{{\rm #1}}
  2951. \def\doshortpageno#1{{\rm #1}}
  2952. \def\chapentryfonts{\secfonts \rm}
  2953. \def\secentryfonts{\textfonts}
  2954. \let\subsecentryfonts = \textfonts
  2955. \let\subsubsecentryfonts = \textfonts
  2956. \message{environments,}
  2957. % Since these characters are used in examples, it should be an even number of
  2958. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2959. % Furthermore, these definitions must come after we define our fonts.
  2960. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2961. \newbox\pushcharbox    \newbox\bullbox
  2962. \newbox\equivbox       \newbox\errorbox
  2963. %{\tentt
  2964. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2965. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2966. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2967. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2968. % Adapted from the manmac format (p.420 of TeXbook)
  2969. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2970. %                                      depth .1ex\hfil}
  2971. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  2972. \def\point{$\star$}
  2973. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2974. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2975. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2976. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2977. % Adapted from the TeXbook's \boxit.
  2978. {\tentt \global\dimen0 = 3em}% Width of the box.
  2979. \dimen2 = .55pt % Thickness of rules
  2980. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2981. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2982. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2983.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2984.    \advance\hsize by -2\dimen2 % Rules.
  2985.    \vbox{
  2986.       \hrule height\dimen2
  2987.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2988.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2989.          \kern3pt\vrule width\dimen2}% Space to right.
  2990.       \hrule height\dimen2}
  2991.     \hfil}
  2992. % The @error{} command.
  2993. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2994. % @tex ... @end tex    escapes into raw Tex temporarily.
  2995. % One exception: @ is still an escape character, so that @end tex works.
  2996. % But \@ or @@ will get a plain tex @ character.
  2997. \def\tex{\begingroup
  2998.   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2999.   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  3000.   \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  3001.   \catcode `\%=14
  3002.   \catcode 43=12 % plus
  3003.   \catcode`\"=12
  3004.   \catcode`\==12
  3005.   \catcode`\|=12
  3006.   \catcode`\<=12
  3007.   \catcode`\>=12
  3008.   \escapechar=`\\
  3009.   \let\b=\ptexb
  3010.   \let\bullet=\ptexbullet
  3011.   \let\c=\ptexc
  3012.   \let\,=\ptexcomma
  3013.   \let\.=\ptexdot
  3014.   \let\dots=\ptexdots
  3015.   \let\equiv=\ptexequiv
  3016.   \let\!=\ptexexclam
  3017.   \let\i=\ptexi
  3018.   \let\{=\ptexlbrace
  3019.   \let\+=\tabalign
  3020.   \let\}=\ptexrbrace
  3021.   \let\*=\ptexstar
  3022.   \let\t=\ptext
  3023.   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  3024.   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  3025.   \def\@{@}%
  3026. \let\Etex=\endgroup}
  3027. % Define @lisp ... @endlisp.
  3028. % @lisp does a \begingroup so it can rebind things,
  3029. % including the definition of @endlisp (which normally is erroneous).
  3030. % Amount to narrow the margins by for @lisp.
  3031. \newskip\lispnarrowing \lispnarrowing=0.4in
  3032. % This is the definition that ^^M gets inside @lisp, @example, and other
  3033. % such environments.  \null is better than a space, since it doesn't
  3034. % have any width.
  3035. \def\lisppar{\null\endgraf}
  3036. % Make each space character in the input produce a normal interword
  3037. % space in the output.  Don't allow a line break at this space, as this
  3038. % is used only in environments like @example, where each line of input
  3039. % should produce a line of output anyway.
  3040. {\obeyspaces %
  3041. \gdef\sepspaces{\obeyspaces\let =\tie}}
  3042. % Define \obeyedspace to be our active space, whatever it is.  This is
  3043. % for use in \parsearg.
  3044. {\sepspaces%
  3045. \global\let\obeyedspace= }
  3046. % This space is always present above and below environments.
  3047. \newskip\envskipamount \envskipamount = 0pt
  3048. % Make spacing and below environment symmetrical.  We use \parskip here
  3049. % to help in doing that, since in @example-like environments \parskip
  3050. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  3051. % start of the next paragraph will insert \parskip
  3052. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  3053. \endgraf \ifdim\lastskip<\envskipamount
  3054. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  3055. \let\afterenvbreak = \aboveenvbreak
  3056. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  3057. \let\nonarrowing=\relax
  3058. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  3059. % environment contents.
  3060. \font\circle=lcircle10
  3061. \newdimen\circthick
  3062. \newdimen\cartouter\newdimen\cartinner
  3063. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  3064. \circthick=\fontdimen8\circle
  3065. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  3066. \def\ctr{{\hskip 6pt\circle\char'010}}
  3067. \def\cbl{{\circle\char'012\hskip -6pt}}
  3068. \def\cbr{{\hskip 6pt\circle\char'011}}
  3069. \def\carttop{\hbox to \cartouter{\hskip\lskip
  3070.         \ctl\leaders\hrule height\circthick\hfil\ctr
  3071.         \hskip\rskip}}
  3072. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  3073.         \cbl\leaders\hrule height\circthick\hfil\cbr
  3074.         \hskip\rskip}}
  3075. \newskip\lskip\newskip\rskip
  3076. \long\def\cartouche{%
  3077. \begingroup
  3078.         \lskip=\leftskip \rskip=\rightskip
  3079.         \leftskip=0pt\rightskip=0pt %we want these *outside*.
  3080.         \cartinner=\hsize \advance\cartinner by-\lskip
  3081.                           \advance\cartinner by-\rskip
  3082.         \cartouter=\hsize
  3083.         \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  3084. %                                    side, and for 6pt waste from
  3085. %                                    each corner char, and rule thickness
  3086.         \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  3087.         % Flag to tell @lisp, etc., not to narrow margin.
  3088.         \let\nonarrowing=\comment
  3089.         \vbox\bgroup
  3090.                 \baselineskip=0pt\parskip=0pt\lineskip=0pt
  3091.                 \carttop
  3092.                 \hbox\bgroup
  3093.                         \hskip\lskip
  3094.                         \vrule\kern3pt
  3095.                         \vbox\bgroup
  3096.                                 \hsize=\cartinner
  3097.                                 \kern3pt
  3098.                                 \begingroup
  3099.                                         \baselineskip=\normbskip
  3100.                                         \lineskip=\normlskip
  3101.                                         \parskip=\normpskip
  3102.                                         \vskip -\parskip
  3103. \def\Ecartouche{%
  3104.                                 \endgroup
  3105.                                 \kern3pt
  3106.                         \egroup
  3107.                         \kern3pt\vrule
  3108.                         \hskip\rskip
  3109.                 \egroup
  3110.                 \cartbot
  3111.         \egroup
  3112. \endgroup
  3113. % This macro is called at the beginning of all the @example variants,
  3114. % inside a group.
  3115. \def\nonfillstart{%
  3116.   \aboveenvbreak
  3117.   \inENV % This group ends at the end of the body
  3118.   \hfuzz = 12pt % Don't be fussy
  3119.   \sepspaces % Make spaces be word-separators rather than space tokens.
  3120.   \singlespace
  3121.   \let\par = \lisppar % don't ignore blank lines
  3122.   \obeylines % each line of input is a line of output
  3123.   \parskip = 0pt
  3124.   \parindent = 0pt
  3125.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  3126.   % @cartouche defines \nonarrowing to inhibit narrowing
  3127.   % at next level down.
  3128.   \ifx\nonarrowing\relax
  3129.     \advance \leftskip by \lispnarrowing
  3130.     \exdentamount=\lispnarrowing
  3131.     \let\exdent=\nofillexdent
  3132.     \let\nonarrowing=\relax
  3133.   \fi
  3134. % Define the \E... control sequence only if we are inside the particular
  3135. % environment, so the error checking in \end will work.
  3136. % To end an @example-like environment, we first end the paragraph (via
  3137. % \afterenvbreak's vertical glue), and then the group.  That way we keep
  3138. % the zero \parskip that the environments set -- \parskip glue will be
  3139. % inserted at the beginning of the next paragraph in the document, after
  3140. % the environment.
  3141. \def\nonfillfinish{\afterenvbreak\endgroup}
  3142. % @lisp: indented, narrowed, typewriter font.
  3143. \def\lisp{\begingroup
  3144.   \nonfillstart
  3145.   \let\Elisp = \nonfillfinish
  3146.   \tt
  3147.   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  3148.   \gobble       % eat return
  3149. % @example: Same as @lisp.
  3150. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  3151. % @small... is usually equivalent to the non-small (@smallbook
  3152. % redefines).  We must call \example (or whatever) last in the
  3153. % definition, since it reads the return following the @example (or
  3154. % whatever) command.
  3155. % This actually allows (for example) @end display inside an
  3156. % @smalldisplay.  Too bad, but makeinfo will catch the error anyway.
  3157. \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
  3158. \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  3159. \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
  3160. \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  3161. % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
  3162. % Originally contributed by Pavel@xerox.
  3163. \def\smalllispx{\begingroup
  3164.   \def\Esmalllisp{\nonfillfinish\endgroup}%
  3165.   \def\Esmallexample{\nonfillfinish\endgroup}%
  3166.   \indexfonts
  3167.   \lisp
  3168. % @display: same as @lisp except keep current font.
  3169. \def\display{\begingroup
  3170.   \nonfillstart
  3171.   \let\Edisplay = \nonfillfinish
  3172.   \gobble
  3173. % @smalldisplay (when @smallbook): @display plus smaller fonts.
  3174. \def\smalldisplayx{\begingroup
  3175.   \def\Esmalldisplay{\nonfillfinish\endgroup}%
  3176.   \indexfonts \rm
  3177.   \display
  3178. % @format: same as @display except don't narrow margins.
  3179. \def\format{\begingroup
  3180.   \let\nonarrowing = t
  3181.   \nonfillstart
  3182.   \let\Eformat = \nonfillfinish
  3183.   \gobble
  3184. % @smallformat (when @smallbook): @format plus smaller fonts.
  3185. \def\smallformatx{\begingroup
  3186.   \def\Esmallformat{\nonfillfinish\endgroup}%
  3187.   \indexfonts \rm
  3188.   \format
  3189. % @flushleft (same as @format).
  3190. \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
  3191. % @flushright.
  3192. \def\flushright{\begingroup
  3193.   \let\nonarrowing = t
  3194.   \nonfillstart
  3195.   \let\Eflushright = \nonfillfinish
  3196.   \advance\leftskip by 0pt plus 1fill
  3197.   \gobble
  3198. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  3199. % and narrows the margins.
  3200. \def\quotation{%
  3201.   \begingroup\inENV %This group ends at the end of the @quotation body
  3202.   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  3203.   \singlespace
  3204.   \parindent=0pt
  3205.   % We have retained a nonzero parskip for the environment, since we're
  3206.   % doing normal filling. So to avoid extra space below the environment...
  3207.   \def\Equotation{\parskip = 0pt \nonfillfinish}%
  3208.   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  3209.   \ifx\nonarrowing\relax
  3210.     \advance\leftskip by \lispnarrowing
  3211.     \advance\rightskip by \lispnarrowing
  3212.     \exdentamount = \lispnarrowing
  3213.     \let\nonarrowing = \relax
  3214.   \fi
  3215. \message{defuns,}
  3216. % Define formatter for defuns
  3217. % First, allow user to change definition object font (\df) internally
  3218. \def\setdeffont #1 {\csname DEF#1\endcsname}
  3219. \newskip\defbodyindent \defbodyindent=.4in
  3220. \newskip\defargsindent \defargsindent=50pt
  3221. \newskip\deftypemargin \deftypemargin=12pt
  3222. \newskip\deflastargmargin \deflastargmargin=18pt
  3223. \newcount\parencount
  3224. % define \functionparens, which makes ( and ) and & do special things.
  3225. % \functionparens affects the group it is contained in.
  3226. \def\activeparens{%
  3227. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  3228. \catcode`\[=\active \catcode`\]=\active}
  3229. % Make control sequences which act like normal parenthesis chars.
  3230. \let\lparen = ( \let\rparen = )
  3231. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  3232. % Be sure that we always have a definition for `(', etc.  For example,
  3233. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  3234. % so TeX would otherwise complain about undefined control sequence.
  3235. \global\let(=\lparen \global\let)=\rparen
  3236. \global\let[=\lbrack \global\let]=\rbrack
  3237. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  3238. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  3239. % This is used to turn on special parens
  3240. % but make & act ordinary (given that it's active).
  3241. \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
  3242. % Definitions of (, ) and & used in args for functions.
  3243. % This is the definition of ( outside of all parentheses.
  3244. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
  3245.   \global\advance\parencount by 1
  3246. % This is the definition of ( when already inside a level of parens.
  3247. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  3248. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  3249.   % also in that case restore the outer-level definition of (.
  3250.   \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  3251.   \global\advance \parencount by -1 }
  3252. % If we encounter &foo, then turn on ()-hacking afterwards
  3253. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  3254. \gdef\normalparens{\boldbrax\let&=\ampnr}
  3255. } % End of definition inside \activeparens
  3256. %% These parens (in \boldbrax) actually are a little bolder than the
  3257. %% contained text.  This is especially needed for [ and ]
  3258. \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
  3259. \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
  3260. \def\ampnr{\&}
  3261. \def\lbrb{{\bf\char`\[}}
  3262. \def\rbrb{{\bf\char`\]}}
  3263. % First, defname, which formats the header line itself.
  3264. % #1 should be the function name.
  3265. % #2 should be the type of definition, such as "Function".
  3266. \def\defname #1#2{%
  3267. % Get the values of \leftskip and \rightskip as they were
  3268. % outside the @def...
  3269. \dimen2=\leftskip
  3270. \advance\dimen2 by -\defbodyindent
  3271. \noindent
  3272. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  3273. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  3274. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  3275. \parshape 2 0in \dimen0 \defargsindent \dimen1
  3276. % Now output arg 2 ("Function" or some such)
  3277. % ending at \deftypemargin from the right margin,
  3278. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  3279. {% Adjust \hsize to exclude the ambient margins,
  3280. % so that \rightline will obey them.
  3281. \advance \hsize by -\dimen2
  3282. \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
  3283. % Make all lines underfull and no complaints:
  3284. \tolerance=10000 \hbadness=10000
  3285. \advance\leftskip by -\defbodyindent
  3286. \exdentamount=\defbodyindent
  3287. {\df #1}\enskip        % Generate function name
  3288. % Actually process the body of a definition
  3289. % #1 should be the terminating control sequence, such as \Edefun.
  3290. % #2 should be the "another name" control sequence, such as \defunx.
  3291. % #3 should be the control sequence that actually processes the header,
  3292. %    such as \defunheader.
  3293. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  3294. \medbreak %
  3295. % Define the end token that this defining construct specifies
  3296. % so that it will exit this group.
  3297. \def#1{\endgraf\endgroup\medbreak}%
  3298. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  3299. \parindent=0in
  3300. \advance\leftskip by \defbodyindent
  3301. \exdentamount=\defbodyindent
  3302. \begingroup %
  3303. \catcode 61=\active % 61 is `='
  3304. \obeylines\activeparens\spacesplit#3}
  3305. % #1 is the \E... control sequence to end the definition (which we define).
  3306. % #2 is the \...x control sequence for consecutive fns (which we define).
  3307. % #3 is the control sequence to call to resume processing.
  3308. % #4, delimited by the space, is the class name.
  3309. \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
  3310. \medbreak %
  3311. % Define the end token that this defining construct specifies
  3312. % so that it will exit this group.
  3313. \def#1{\endgraf\endgroup\medbreak}%
  3314. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  3315. \parindent=0in
  3316. \advance\leftskip by \defbodyindent
  3317. \exdentamount=\defbodyindent
  3318. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  3319. % @deftypemethod has an extra argument that nothing else does.  Sigh.
  3320. % #1 is the \E... control sequence to end the definition (which we define).
  3321. % #2 is the \...x control sequence for consecutive fns (which we define).
  3322. % #3 is the control sequence to call to resume processing.
  3323. % #4, delimited by the space, is the class name.
  3324. % #5 is the method's return type.
  3325. \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
  3326. \medbreak %
  3327. % Define the end token that this defining construct specifies
  3328. % so that it will exit this group.
  3329. \def#1{\endgraf\endgroup\medbreak}%
  3330. \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
  3331. \parindent=0in
  3332. \advance\leftskip by \defbodyindent
  3333. \exdentamount=\defbodyindent
  3334. \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
  3335. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  3336. \medbreak %
  3337. % Define the end token that this defining construct specifies
  3338. % so that it will exit this group.
  3339. \def#1{\endgraf\endgroup\medbreak}%
  3340. \def#2##1 ##2 {\def#4{##1}%
  3341. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  3342. \parindent=0in
  3343. \advance\leftskip by \defbodyindent
  3344. \exdentamount=\defbodyindent
  3345. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  3346. % These parsing functions are similar to the preceding ones
  3347. % except that they do not make parens into active characters.
  3348. % These are used for "variables" since they have no arguments.
  3349. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  3350. \medbreak %
  3351. % Define the end token that this defining construct specifies
  3352. % so that it will exit this group.
  3353. \def#1{\endgraf\endgroup\medbreak}%
  3354. \def#2{\begingroup\obeylines\spacesplit#3}%
  3355. \parindent=0in
  3356. \advance\leftskip by \defbodyindent
  3357. \exdentamount=\defbodyindent
  3358. \begingroup %
  3359. \catcode 61=\active %
  3360. \obeylines\spacesplit#3}
  3361. % This is used for \def{tp,vr}parsebody.  It could probably be used for
  3362. % some of the others, too, with some judicious conditionals.
  3363. \def\parsebodycommon#1#2#3{%
  3364.   \begingroup\inENV %
  3365.   \medbreak %
  3366.   % Define the end token that this defining construct specifies
  3367.   % so that it will exit this group.
  3368.   \def#1{\endgraf\endgroup\medbreak}%
  3369.   \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  3370.   \parindent=0in
  3371.   \advance\leftskip by \defbodyindent
  3372.   \exdentamount=\defbodyindent
  3373.   \begingroup\obeylines
  3374. \def\defvrparsebody#1#2#3#4 {%
  3375.   \parsebodycommon{#1}{#2}{#3}%
  3376.   \spacesplit{#3{#4}}%
  3377. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  3378. % type is just `struct', because we lose the braces in `{struct
  3379. % termios}' when \spacesplit reads its undelimited argument.  Sigh.
  3380. % \let\deftpparsebody=\defvrparsebody
  3381. % So, to get around this, we put \empty in with the type name.  That
  3382. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  3383. % won't strip off the braces.
  3384. \def\deftpparsebody #1#2#3#4 {%
  3385.   \parsebodycommon{#1}{#2}{#3}%
  3386.   \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  3387. % Fine, but then we have to eventually remove the \empty *and* the
  3388. % braces (if any).  That's what this does.
  3389. \def\removeemptybraces\empty#1\relax{#1}
  3390. % After \spacesplit has done its work, this is called -- #1 is the final
  3391. % thing to call, #2 the type name (which starts with \empty), and #3
  3392. % (which might be empty) the arguments.
  3393. \def\parsetpheaderline#1#2#3{%
  3394.   #1{\removeemptybraces#2\relax}{#3}%
  3395. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  3396. \medbreak %
  3397. % Define the end token that this defining construct specifies
  3398. % so that it will exit this group.
  3399. \def#1{\endgraf\endgroup\medbreak}%
  3400. \def#2##1 ##2 {\def#4{##1}%
  3401. \begingroup\obeylines\spacesplit{#3{##2}}}%
  3402. \parindent=0in
  3403. \advance\leftskip by \defbodyindent
  3404. \exdentamount=\defbodyindent
  3405. \begingroup\obeylines\spacesplit{#3{#5}}}
  3406. % Split up #2 at the first space token.
  3407. % call #1 with two arguments:
  3408. %  the first is all of #2 before the space token,
  3409. %  the second is all of #2 after that space token.
  3410. % If #2 contains no space token, all of it is passed as the first arg
  3411. % and the second is passed as empty.
  3412. {\obeylines
  3413. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  3414. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  3415. \ifx\relax #3%
  3416. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  3417. % So much for the things common to all kinds of definitions.
  3418. % Define @defun.
  3419. % First, define the processing that is wanted for arguments of \defun
  3420. % Use this to expand the args and terminate the paragraph they make up
  3421. \def\defunargs #1{\functionparens \sl
  3422. % Expand, preventing hyphenation at `-' chars.
  3423. % Note that groups don't affect changes in \hyphenchar.
  3424. \hyphenchar\tensl=0
  3425. \hyphenchar\tensl=45
  3426. \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
  3427. \interlinepenalty=10000
  3428. \advance\rightskip by 0pt plus 1fil
  3429. \endgraf\nobreak\vskip -\parskip\nobreak
  3430. \def\deftypefunargs #1{%
  3431. % Expand, preventing hyphenation at `-' chars.
  3432. % Note that groups don't affect changes in \hyphenchar.
  3433. % Use \boldbraxnoamp, not \functionparens, so that & is not special.
  3434. \boldbraxnoamp
  3435. \tclose{#1}% avoid \code because of side effects on active chars
  3436. \interlinepenalty=10000
  3437. \advance\rightskip by 0pt plus 1fil
  3438. \endgraf\nobreak\vskip -\parskip\nobreak
  3439. % Do complete processing of one @defun or @defunx line already parsed.
  3440. % @deffn Command forward-char nchars
  3441. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  3442. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  3443. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  3444. \catcode 61=\other % Turn off change made in \defparsebody
  3445. % @defun == @deffn Function
  3446. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  3447. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3448. \begingroup\defname {#1}{Function}%
  3449. \defunargs {#2}\endgroup %
  3450. \catcode 61=\other % Turn off change made in \defparsebody
  3451. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  3452. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  3453. % #1 is the data type.  #2 is the name and args.
  3454. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  3455. % #1 is the data type, #2 the name, #3 the args.
  3456. \def\deftypefunheaderx #1#2 #3\relax{%
  3457. \doind {fn}{\code{#2}}% Make entry in function index
  3458. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
  3459. \deftypefunargs {#3}\endgroup %
  3460. \catcode 61=\other % Turn off change made in \defparsebody
  3461. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  3462. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  3463. % \defheaderxcond#1\relax$$$
  3464. % puts #1 in @code, followed by a space, but does nothing if #1 is null.
  3465. \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
  3466. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  3467. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  3468. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  3469. \def\deftypefnheaderx #1#2#3 #4\relax{%
  3470. \doind {fn}{\code{#3}}% Make entry in function index
  3471. \begingroup
  3472. \normalparens % notably, turn off `&' magic, which prevents
  3473. %               at least some C++ text from working
  3474. \defname {\defheaderxcond#2\relax$$$#3}{#1}%
  3475. \deftypefunargs {#4}\endgroup %
  3476. \catcode 61=\other % Turn off change made in \defparsebody
  3477. % @defmac == @deffn Macro
  3478. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  3479. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3480. \begingroup\defname {#1}{Macro}%
  3481. \defunargs {#2}\endgroup %
  3482. \catcode 61=\other % Turn off change made in \defparsebody
  3483. % @defspec == @deffn Special Form
  3484. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  3485. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3486. \begingroup\defname {#1}{Special Form}%
  3487. \defunargs {#2}\endgroup %
  3488. \catcode 61=\other % Turn off change made in \defparsebody
  3489. % This definition is run if you use @defunx
  3490. % anywhere other than immediately after a @defun or @defunx.
  3491. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  3492. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  3493. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  3494. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  3495. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  3496. \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
  3497. \def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}}
  3498. % @defmethod, and so on
  3499. % @defop CATEGORY CLASS OPERATION ARG...
  3500. \def\defop #1 {\def\defoptype{#1}%
  3501. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  3502. \def\defopheader #1#2#3{%
  3503. \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
  3504. \begingroup\defname {#2}{\defoptype{} on #1}%
  3505. \defunargs {#3}\endgroup %
  3506. % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
  3507. \def\deftypemethod{%
  3508.   \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
  3509. % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
  3510. \def\deftypemethodheader#1#2#3#4{%
  3511.   \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  3512.   \begingroup
  3513.     \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
  3514.     \deftypefunargs{#4}%
  3515.   \endgroup
  3516. % @defmethod == @defop Method
  3517. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  3518. % #1 is the class name, #2 the method name, #3 the args.
  3519. \def\defmethodheader#1#2#3{%
  3520.   \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
  3521.   \begingroup
  3522.     \defname{#2}{\putwordMethodon\ \code{#1}}%
  3523.     \defunargs{#3}%
  3524.   \endgroup
  3525. % @defcv {Class Option} foo-class foo-flag
  3526. \def\defcv #1 {\def\defcvtype{#1}%
  3527. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  3528. \def\defcvarheader #1#2#3{%
  3529. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  3530. \begingroup\defname {#2}{\defcvtype{} of #1}%
  3531. \defvarargs {#3}\endgroup %
  3532. % @defivar == @defcv {Instance Variable}
  3533. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  3534. \def\defivarheader #1#2#3{%
  3535. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  3536. \begingroup\defname {#2}{Instance Variable of #1}%
  3537. \defvarargs {#3}\endgroup %
  3538. % These definitions are run if you use @defmethodx, etc.,
  3539. % anywhere other than immediately after a @defmethod, etc.
  3540. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  3541. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  3542. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  3543. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  3544. % Now @defvar
  3545. % First, define the processing that is wanted for arguments of @defvar.
  3546. % This is actually simple: just print them in roman.
  3547. % This must expand the args and terminate the paragraph they make up
  3548. \def\defvarargs #1{\normalparens #1%
  3549. \interlinepenalty=10000
  3550. \endgraf\nobreak\vskip -\parskip\nobreak}
  3551. % @defvr Counter foo-count
  3552. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  3553. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  3554. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  3555. % @defvar == @defvr Variable
  3556. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  3557. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  3558. \begingroup\defname {#1}{Variable}%
  3559. \defvarargs {#2}\endgroup %
  3560. % @defopt == @defvr {User Option}
  3561. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  3562. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  3563. \begingroup\defname {#1}{User Option}%
  3564. \defvarargs {#2}\endgroup %
  3565. % @deftypevar int foobar
  3566. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  3567. % #1 is the data type.  #2 is the name, perhaps followed by text that
  3568. % is actually part of the data type, which should not be put into the index.
  3569. \def\deftypevarheader #1#2{%
  3570. \dovarind#2 \relax% Make entry in variables index
  3571. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
  3572. \interlinepenalty=10000
  3573. \endgraf\nobreak\vskip -\parskip\nobreak
  3574. \endgroup}
  3575. \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
  3576. % @deftypevr {Global Flag} int enable
  3577. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  3578. \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
  3579. \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
  3580. \interlinepenalty=10000
  3581. \endgraf\nobreak\vskip -\parskip\nobreak
  3582. \endgroup}
  3583. % This definition is run if you use @defvarx
  3584. % anywhere other than immediately after a @defvar or @defvarx.
  3585. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  3586. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  3587. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  3588. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  3589. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  3590. % Now define @deftp
  3591. % Args are printed in bold, a slight difference from @defvar.
  3592. \def\deftpargs #1{\bf \defvarargs{#1}}
  3593. % @deftp Class window height width ...
  3594. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  3595. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  3596. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  3597. % This definition is run if you use @deftpx, etc
  3598. % anywhere other than immediately after a @deftp, etc.
  3599. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  3600. \message{macros,}
  3601. % @macro.
  3602. % To do this right we need a feature of e-TeX, \scantokens, 
  3603. % which we arrange to emulate with a temporary file in ordinary TeX.
  3604. \ifx\eTeXversion\undefined
  3605.  \newwrite\macscribble
  3606.  \def\scanmacro#1{%
  3607.    \begingroup \newlinechar`\^^M
  3608.    \immediate\openout\macscribble=\jobname.tmp
  3609.    \immediate\write\macscribble{#1}%
  3610.    \immediate\closeout\macscribble
  3611.    \let\xeatspaces\eatspaces
  3612.    \input \jobname.tmp
  3613.    \endgroup
  3614. \else
  3615. \def\scanmacro#1{%
  3616. \begingroup \newlinechar`\^^M
  3617. \let\xeatspaces\eatspaces\scantokens{#1}\endgroup}
  3618. \newcount\paramno   % Count of parameters
  3619. \newtoks\macname    % Macro name
  3620. \newif\ifrecursive  % Is it recursive?
  3621. % Utility routines.
  3622. % Thisdoes \let #1 = #2, except with \csnames.
  3623. \def\cslet#1#2{%
  3624. \expandafter\expandafter
  3625. \expandafter\let
  3626. \expandafter\expandafter
  3627. \csname#1\endcsname
  3628. \csname#2\endcsname}
  3629. % Trim leading and trailing spaces off a string.
  3630. % Concepts from aro-bend problem 15 (see CTAN).
  3631. {\catcode`\@=11
  3632. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  3633. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  3634. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  3635. \def\unbrace#1{#1}
  3636. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  3637. % Trim a single trailing ^^M off a string.
  3638. {\catcode`\^^M=12\catcode`\Q=3%
  3639. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  3640. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  3641. \gdef\eatcrb#1Q#2Q{#1}%
  3642. % Macro bodies are absorbed as an argument in a context where
  3643. % all characters are catcode 10, 11 or 12, except \ which is active
  3644. % (as in normal texinfo). It is necessary to change the definition of \.
  3645. % It's necessary to have hard CRs when the macro is executed. This is 
  3646. % done by  making ^^M (\endlinechar) catcode 12 when reading the macro 
  3647. % body, and then making it the \newlinechar in \scanmacro.
  3648. \def\macrobodyctxt{%
  3649.   \catcode`\~=12
  3650.   \catcode`\^=12
  3651.   \catcode`\_=12
  3652.   \catcode`\|=12
  3653.   \catcode`\<=12
  3654.   \catcode`\>=12
  3655.   \catcode`\+=12
  3656.   \catcode`\{=12
  3657.   \catcode`\}=12
  3658.   \catcode`\@=12
  3659.   \catcode`\^^M=12
  3660.   \usembodybackslash}
  3661. \def\macroargctxt{%
  3662.   \catcode`\~=12
  3663.   \catcode`\^=12
  3664.   \catcode`\_=12
  3665.   \catcode`\|=12
  3666.   \catcode`\<=12
  3667.   \catcode`\>=12
  3668.   \catcode`\+=12
  3669.   \catcode`\@=12
  3670.   \catcode`\\=12}
  3671. % \mbodybackslash is the definition of \ in @macro bodies.
  3672. % It maps \foo\ => \csname macarg.foo\endcsname => #N 
  3673. % where N is the macro parameter number.
  3674. % We define \csname macarg.\endcsname to be \realbackslash, so
  3675. % \\ in macro replacement text gets you a backslash.
  3676. {\catcode`@=0 @catcode`@\=@active
  3677.  @gdef@usembodybackslash{@let\=@mbodybackslash}
  3678.  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  3679. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  3680. \def\macro{\recursivefalse\parsearg\macroxxx}
  3681. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  3682. \def\macroxxx#1{%
  3683.   \getargs{#1}%           now \macname is the macname and \argl the arglist
  3684.   \ifx\argl\empty       % no arguments
  3685.      \paramno=0%
  3686.   \else
  3687.      \expandafter\parsemargdef \argl;% 
  3688.   \fi
  3689.   \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
  3690.      \cslet{macsave.\the\macname}{\the\macname}%
  3691.   \else
  3692.      \message{Warning: redefining \the\macname}%
  3693.   \fi
  3694.   \begingroup \macrobodyctxt
  3695.   \ifrecursive \expandafter\parsermacbody
  3696.   \else \expandafter\parsemacbody 
  3697.   \fi}
  3698. \def\unmacro{\parsearg\unmacroxxx}
  3699. \def\unmacroxxx#1{%
  3700.   \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
  3701.     \errmessage{Macro \the\macname\ not defined.}%
  3702.   \else
  3703.     \cslet{#1}{macsave.#1}%
  3704.     \expandafter\let \csname macsave.\the\macname\endcsname \undefined
  3705.   \fi
  3706. % This makes use of the obscure feature that if the last token of a
  3707. % <parameter list> is #, then the preceding argument is delimited by
  3708. % an opening brace, and that opening brace is not consumed.
  3709. \def\getargs#1{\getargsxxx#1{}}
  3710. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  3711. \def\getmacname #1 #2\relax{\macname={#1}}
  3712. \def\getmacargs#1{\def\argl{#1}}
  3713. % Parse the optional {params} list.  Set up \paramno and \paramlist
  3714. % so \defmacro knows what to do.  Define \macarg.blah for each blah
  3715. % in the params list, to be ##N where N is the position in that list.
  3716. % That gets used by \mbodybackslash (above).
  3717. % We need to get `macro parameter char #' into several definitions.
  3718. % The technique used is stolen from LaTeX:  let \hash be something
  3719. % unexpandable, insert that wherever you need a #, and then redefine
  3720. % it to # just before using the token list produced.
  3721. % The same technique is used to protect \eatspaces till just before
  3722. % the macro is used.
  3723. \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
  3724.         \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
  3725. \def\parsemargdefxxx#1,{%
  3726.   \if#1;\let\next=\relax
  3727.   \else \let\next=\parsemargdefxxx
  3728.     \advance\paramno by 1%
  3729.     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  3730.         {\xeatspaces{\hash\the\paramno}}%
  3731.     \edef\paramlist{\paramlist\hash\the\paramno,}%
  3732.   \fi\next}
  3733. % These two commands read recursive and nonrecursive macro bodies.
  3734. % (They're different since rec and nonrec macros end differently.)
  3735. \long\def\parsemacbody#1@end macro%
  3736. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  3737. \long\def\parsermacbody#1@end rmacro%
  3738. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  3739. % This defines the macro itself. There are six cases: recursive and
  3740. % nonrecursive macros of zero, one, and many arguments.
  3741. % Much magic with \expandafter here.
  3742. % \xdef is used so that macro definitions will survive the file
  3743. % they're defined in; @include reads the file inside a group.
  3744. \def\defmacro{%
  3745.   \let\hash=##% convert placeholders to macro parameter chars
  3746.   \ifrecursive
  3747.     \ifcase\paramno
  3748.     % 0
  3749.       \expandafter\xdef\csname\the\macname\endcsname{%
  3750.         \noexpand\scanmacro{\temp}}%
  3751.     \or % 1
  3752.       \expandafter\xdef\csname\the\macname\endcsname{%
  3753.          \bgroup\noexpand\macroargctxt
  3754.          \noexpand\braceorline\csname\the\macname xxx\endcsname}%
  3755.       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  3756.          \egroup\noexpand\scanmacro{\temp}}%
  3757.     \else % many
  3758.       \expandafter\xdef\csname\the\macname\endcsname{%
  3759.          \bgroup\noexpand\macroargctxt
  3760.          \noexpand\csname\the\macname xx\endcsname}
  3761.       \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  3762.           \csname\the\macname xxx\endcsname ##1,}%
  3763.       \expandafter\expandafter
  3764.       \expandafter\xdef
  3765.       \expandafter\expandafter
  3766.         \csname\the\macname xxx\endcsname 
  3767.           \paramlist{\egroup\noexpand\scanmacro{\temp}}%
  3768.     \fi
  3769.   \else
  3770.     \ifcase\paramno
  3771.     % 0
  3772.       \expandafter\xdef\csname\the\macname\endcsname{%
  3773.         \noexpand\norecurse{\the\macname}%
  3774.         \noexpand\scanmacro{\temp}\egroup}%
  3775.     \or % 1
  3776.       \expandafter\xdef\csname\the\macname\endcsname{%
  3777.          \bgroup\noexpand\macroargctxt
  3778.          \noexpand\braceorline\csname\the\macname xxx\endcsname}%
  3779.       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  3780.         \egroup
  3781.         \noexpand\norecurse{\the\macname}%
  3782.         \noexpand\scanmacro{\temp}\egroup}%
  3783.     \else % many
  3784.       \expandafter\xdef\csname\the\macname\endcsname{%
  3785.          \bgroup\noexpand\macroargctxt
  3786.          \noexpand\csname\the\macname xx\endcsname}
  3787.       \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  3788.           \csname\the\macname xxx\endcsname ##1,}%
  3789.       \expandafter\expandafter
  3790.       \expandafter\xdef
  3791.       \expandafter\expandafter
  3792.       \csname\the\macname xxx\endcsname
  3793.       \paramlist{%
  3794.           \egroup
  3795.           \noexpand\norecurse{\the\macname}%
  3796.           \noexpand\scanmacro{\temp}\egroup}%
  3797.     \fi
  3798.   \fi}
  3799. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  3800. % \braceorline decides whether the next nonwhitespace character is a
  3801. % {.  If so it reads up to the closing }, if not, it reads the whole
  3802. % line.  Whatever was read is then fed to the next control sequence
  3803. % as an argument (by \parsebrace or \parsearg)
  3804. \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
  3805. \def\braceorlinexxx{%
  3806.   \ifx\nchar\bgroup\else
  3807.     \expandafter\parsearg 
  3808.   \fi \next}
  3809. \message{cross references,}
  3810. \newwrite\auxfile
  3811. \newif\ifhavexrefs    % True if xref values are known.
  3812. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  3813. % @inforef is relatively simple.
  3814. \def\inforef #1{\inforefzzz #1,,,,**}
  3815. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  3816.   node \samp{\ignorespaces#1{}}}
  3817. % @node's job is to define \lastnode.
  3818. \def\node{\ENVcheck\parsearg\nodezzz}
  3819. \def\nodezzz#1{\nodexxx [#1,]}
  3820. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  3821. \let\nwnode=\node
  3822. \let\lastnode=\relax
  3823. % The sectioning commands (@chapter, etc.) call these.
  3824. \def\donoderef{%
  3825.   \ifx\lastnode\relax\else
  3826.     \expandafter\expandafter\expandafter\setref{\lastnode}%
  3827.       {Ysectionnumberandtype}%
  3828.     \global\let\lastnode=\relax
  3829.   \fi
  3830. \def\unnumbnoderef{%
  3831.   \ifx\lastnode\relax\else
  3832.     \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
  3833.     \global\let\lastnode=\relax
  3834.   \fi
  3835. \def\appendixnoderef{%
  3836.   \ifx\lastnode\relax\else
  3837.     \expandafter\expandafter\expandafter\setref{\lastnode}%
  3838.       {Yappendixletterandtype}%
  3839.     \global\let\lastnode=\relax
  3840.   \fi
  3841. % @anchor{NAME} -- define xref target at arbitrary point.
  3842. \def\anchor#1{\setref{#1}{Ynothing}}
  3843. % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
  3844. % NAME-title, NAME-pg, and NAME-SNT.  Called from \foonoderef.  We have
  3845. % to set \indexdummies so commands such as @code in a section title
  3846. % aren't expanded.  It would be nicer not to expand the titles in the
  3847. % first place, but there's so many layers that that is hard to do.
  3848. \def\setref#1#2{{%
  3849.   \indexdummies
  3850.   \dosetq{#1-title}{Ytitle}%
  3851.   \dosetq{#1-pg}{Ypagenumber}%
  3852.   \dosetq{#1-snt}{#2}
  3853. % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
  3854. % the node name, #2 the name of the Info cross-reference, #3 the printed
  3855. % node name, #4 the name of the Info file, #5 the name of the printed
  3856. % manual.  All but the node name can be omitted.
  3857. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  3858. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  3859. \def\ref#1{\xrefX[#1,,,,,,,]}
  3860. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  3861.   \def\printedmanual{\ignorespaces #5}%
  3862.   \def\printednodename{\ignorespaces #3}%
  3863.   \setbox1=\hbox{\printedmanual}%
  3864.   \setbox0=\hbox{\printednodename}%
  3865.   \ifdim \wd0 = 0pt
  3866.     % No printed node name was explicitly given.
  3867.     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
  3868.       % Use the node name inside the square brackets.
  3869.       \def\printednodename{\ignorespaces #1}%
  3870.     \else
  3871.       % Use the actual chapter/section title appear inside
  3872.       % the square brackets.  Use the real section title if we have it.
  3873.       \ifdim \wd1 > 0pt
  3874.         % It is in another manual, so we don't have it.
  3875.         \def\printednodename{\ignorespaces #1}%
  3876.       \else
  3877.         \ifhavexrefs
  3878.           % We know the real title if we have the xref values.
  3879.           \def\printednodename{\refx{#1-title}{}}%
  3880.         \else
  3881.           % Otherwise just copy the Info node name.
  3882.           \def\printednodename{\ignorespaces #1}%
  3883.         \fi%
  3884.       \fi
  3885.     \fi
  3886.   \fi
  3887.   % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  3888.   % insert empty discretionaries after hyphens, which means that it will
  3889.   % not find a line break at a hyphen in a node names.  Since some manuals
  3890.   % are best written with fairly long node names, containing hyphens, this
  3891.   % is a loss.  Therefore, we give the text of the node name again, so it
  3892.   % is as if TeX is seeing it for the first time.
  3893.   \ifdim \wd1 > 0pt
  3894.     \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
  3895.   \else
  3896.     % _ (for example) has to be the character _ for the purposes of the
  3897.     % control sequence corresponding to the node, but it has to expand
  3898.     % into the usual \leavevmode...\vrule stuff for purposes of
  3899.     % printing. So we \turnoffactive for the \refx-snt, back on for the
  3900.     % printing, back off for the \refx-pg.
  3901.     {\normalturnoffactive
  3902.      % Only output a following space if the -snt ref is nonempty; for
  3903.      % @unnumbered and @anchor, it won't be.
  3904.      \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  3905.      \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  3906.     }%
  3907.     % [mynode], 
  3908.     [\printednodename],\space
  3909.     % page 3
  3910.     \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  3911.   \fi
  3912. \endgroup}
  3913. % \dosetq is the interface for calls from other macros
  3914. % Use \normalturnoffactive so that punctuation chars such as underscore
  3915. % and backslash work in node names.  (\turnoffactive doesn't do \.)
  3916. \def\dosetq#1#2{%
  3917.   {\let\folio=0
  3918.    \normalturnoffactive
  3919.    \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
  3920.    \iflinks
  3921.      \next
  3922.    \fi
  3923. % \internalsetq {foo}{page} expands into
  3924. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  3925. % When the aux file is read, ' is the escape character
  3926. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  3927. % Things to be expanded by \internalsetq
  3928. \def\Ypagenumber{\folio}
  3929. \def\Ytitle{\thissection}
  3930. \def\Ynothing{}
  3931. \def\Ysectionnumberandtype{%
  3932. \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
  3933. \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
  3934. \else \ifnum \subsubsecno=0 %
  3935. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
  3936. \else %
  3937. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  3938. \fi \fi \fi }
  3939. \def\Yappendixletterandtype{%
  3940. \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
  3941. \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
  3942. \else \ifnum \subsubsecno=0 %
  3943. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  3944. \else %
  3945. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  3946. \fi \fi \fi }
  3947. \gdef\xreftie{'tie}
  3948. % Use TeX 3.0's \inputlineno to get the line number, for better error
  3949. % messages, but if we're using an old version of TeX, don't do anything.
  3950. \ifx\inputlineno\thisisundefined
  3951.   \let\linenumber = \empty % Non-3.0.
  3952. \else
  3953.   \def\linenumber{\the\inputlineno:\space}
  3954. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  3955. % If its value is nonempty, SUFFIX is output afterward.
  3956. \def\refx#1#2{%
  3957.   \expandafter\ifx\csname X#1\endcsname\relax
  3958.     % If not defined, say something at least.
  3959.     \angleleft un\-de\-fined\angleright
  3960.     \iflinks
  3961.       \ifhavexrefs
  3962.         \message{\linenumber Undefined cross reference `#1'.}%
  3963.       \else
  3964.         \ifwarnedxrefs\else
  3965.           \global\warnedxrefstrue
  3966.           \message{Cross reference values unknown; you must run TeX again.}%
  3967.         \fi
  3968.       \fi
  3969.     \fi
  3970.   \else
  3971.     % It's defined, so just use it.
  3972.     \csname X#1\endcsname
  3973.   \fi
  3974.   #2% Output the suffix in any case.
  3975. % This is the macro invoked by entries in the aux file.
  3976. \def\xrdef#1{\begingroup
  3977.   % Reenable \ as an escape while reading the second argument.
  3978.   \catcode`\\ = 0
  3979.   \afterassignment\endgroup
  3980.   \expandafter\gdef\csname X#1\endcsname
  3981. % Read the last existing aux file, if any.  No error if none exists.
  3982. \def\readauxfile{\begingroup
  3983.   \catcode`\^^@=\other
  3984.   \catcode`\^^A=\other
  3985.   \catcode`\^^B=\other
  3986.   \catcode`\^^C=\other
  3987.   \catcode`\^^D=\other
  3988.   \catcode`\^^E=\other
  3989.   \catcode`\^^F=\other
  3990.   \catcode`\^^G=\other
  3991.   \catcode`\^^H=\other
  3992.   \catcode`\^^K=\other
  3993.   \catcode`\^^L=\other
  3994.   \catcode`\^^N=\other
  3995.   \catcode`\^^P=\other
  3996.   \catcode`\^^Q=\other
  3997.   \catcode`\^^R=\other
  3998.   \catcode`\^^S=\other
  3999.   \catcode`\^^T=\other
  4000.   \catcode`\^^U=\other
  4001.   \catcode`\^^V=\other
  4002.   \catcode`\^^W=\other
  4003.   \catcode`\^^X=\other
  4004.   \catcode`\^^Z=\other
  4005.   \catcode`\^^[=\other
  4006.   \catcode`\^^\=\other
  4007.   \catcode`\^^]=\other
  4008.   \catcode`\^^^=\other
  4009.   \catcode`\^^_=\other
  4010.   \catcode`\@=\other
  4011.   \catcode`\^=\other
  4012.   % It was suggested to define this as 7, which would allow ^^e4 etc.
  4013.   % in xref tags, i.e., node names.  But since ^^e4 notation isn't
  4014.   % supported in the main text, it doesn't seem desirable.  Furthermore,
  4015.   % that is not enough: for node names that actually contain a ^
  4016.   % character, we would end up writing a line like this: 'xrdef {'hat
  4017.   % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  4018.   % argument, and \hat is not an expandable control sequence.  It could
  4019.   % all be worked out, but why?  Either we support ^^ or we don't.
  4020.   % The other change necessary for this was to define \auxhat:
  4021.   % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  4022.   % and then to call \auxhat in \setq.
  4023.   \catcode`\~=\other
  4024.   \catcode`\[=\other
  4025.   \catcode`\]=\other
  4026.   \catcode`\"=\other
  4027.   \catcode`\_=\other
  4028.   \catcode`\|=\other
  4029.   \catcode`\<=\other
  4030.   \catcode`\>=\other
  4031.   \catcode`\$=\other
  4032.   \catcode`\#=\other
  4033.   \catcode`\&=\other
  4034.   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  4035.   % Make the characters 128-255 be printing characters
  4036.     \count 1=128
  4037.     \def\loop{%
  4038.       \catcode\count 1=\other
  4039.       \advance\count 1 by 1
  4040.       \ifnum \count 1<256 \loop \fi
  4041.     }%
  4042.   % The aux file uses ' as the escape (for now).
  4043.   % Turn off \ as an escape so we do not lose on
  4044.   % entries which were dumped with control sequences in their names.
  4045.   % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  4046.   % Reference to such entries still does not work the way one would wish,
  4047.   % but at least they do not bomb out when the aux file is read in.
  4048.   \catcode`\{=1
  4049.   \catcode`\}=2
  4050.   \catcode`\%=\other
  4051.   \catcode`\'=0
  4052.   \catcode`\\=\other
  4053.   \openin 1 \jobname.aux
  4054.   \ifeof 1 \else
  4055.     \closein 1
  4056.     \input \jobname.aux
  4057.     \global\havexrefstrue
  4058.     \global\warnedobstrue
  4059.   \fi
  4060.   % Open the new aux file.  TeX will close it automatically at exit.
  4061.   \openout\auxfile=\jobname.aux
  4062. \endgroup}
  4063. % Footnotes.
  4064. \newcount \footnoteno
  4065. % The trailing space in the following definition for supereject is
  4066. % vital for proper filling; pages come out unaligned when you do a
  4067. % pagealignmacro call if that space before the closing brace is
  4068. % removed. (Generally, numeric constants should always be followed by a
  4069. % space to prevent strange expansion errors.)
  4070. \def\supereject{\par\penalty -20000\footnoteno =0 }
  4071. % @footnotestyle is meaningful for info output only.
  4072. \let\footnotestyle=\comment
  4073. \let\ptexfootnote=\footnote
  4074. {\catcode `\@=11
  4075. % Auto-number footnotes.  Otherwise like plain.
  4076. \gdef\footnote{%
  4077.   \global\advance\footnoteno by \@ne
  4078.   \edef\thisfootno{$^{\the\footnoteno}$}%
  4079.   % In case the footnote comes at the end of a sentence, preserve the
  4080.   % extra spacing after we do the footnote number.
  4081.   \let\@sf\empty
  4082.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  4083.   % Remove inadvertent blank space before typesetting the footnote number.
  4084.   \unskip
  4085.   \thisfootno\@sf
  4086.   \footnotezzz
  4087. % Don't bother with the trickery in plain.tex to not require the
  4088. % footnote text as a parameter.  Our footnotes don't need to be so general.
  4089. % Oh yes, they do; otherwise, @ifset and anything else that uses
  4090. % \parseargline fail inside footnotes because the tokens are fixed when
  4091. % the footnote is read.  --karl, 16nov96.
  4092. \long\gdef\footnotezzz{\insert\footins\bgroup
  4093.   % We want to typeset this text as a normal paragraph, even if the
  4094.   % footnote reference occurs in (for example) a display environment.
  4095.   % So reset some parameters.
  4096.   \interlinepenalty\interfootnotelinepenalty
  4097.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  4098.   \splitmaxdepth\dp\strutbox
  4099.   \floatingpenalty\@MM
  4100.   \leftskip\z@skip
  4101.   \rightskip\z@skip
  4102.   \spaceskip\z@skip
  4103.   \xspaceskip\z@skip
  4104.   \parindent\defaultparindent
  4105.   % Hang the footnote text off the number.
  4106.   \hang
  4107.   \textindent{\thisfootno}%
  4108.   % Don't crash into the line above the footnote text.  Since this
  4109.   % expands into a box, it must come within the paragraph, lest it
  4110.   % provide a place where TeX can split the footnote.
  4111.   \footstrut
  4112.   \futurelet\next\fo@t
  4113. \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
  4114.   \else\let\next\f@t\fi \next}
  4115. \def\f@@t{\bgroup\aftergroup\@foot\let\next}
  4116. \def\f@t#1{#1\@foot}
  4117. \def\@foot{\strut\egroup}
  4118. }%end \catcode `\@=11
  4119. % Set the baselineskip to #1, and the lineskip and strut size
  4120. % correspondingly.  There is no deep meaning behind these magic numbers
  4121. % used as factors; they just match (closely enough) what Knuth defined.
  4122. \def\lineskipfactor{.08333}
  4123. \def\strutheightpercent{.70833}
  4124. \def\strutdepthpercent {.29167}
  4125. \def\setleading#1{%
  4126.   \normalbaselineskip = #1\relax
  4127.   \normallineskip = \lineskipfactor\normalbaselineskip
  4128.   \normalbaselines
  4129.   \setbox\strutbox =\hbox{%
  4130.     \vrule width0pt height\strutheightpercent\baselineskip
  4131.                     depth \strutdepthpercent \baselineskip
  4132. % @| inserts a changebar to the left of the current line.  It should
  4133. % surround any changed text.  This approach does *not* work if the
  4134. % change spans more than two lines of output.  To handle that, we would
  4135. % have adopt a much more difficult approach (putting marks into the main
  4136. % vertical list for the beginning and end of each change).
  4137. \def\|{%
  4138.   % \vadjust can only be used in horizontal mode.
  4139.   \leavevmode
  4140.   % Append this vertical mode material after the current line in the output.
  4141.   \vadjust{%
  4142.     % We want to insert a rule with the height and depth of the current
  4143.     % leading; that is exactly what \strutbox is supposed to record.
  4144.     \vskip-\baselineskip
  4145.     %
  4146.     % \vadjust-items are inserted at the left edge of the type.  So
  4147.     % the \llap here moves out into the left-hand margin.
  4148.     \llap{%
  4149.       %
  4150.       % For a thicker or thinner bar, change the `1pt'.
  4151.       \vrule height\baselineskip width1pt
  4152.       %
  4153.       % This is the space between the bar and the text.
  4154.       \hskip 12pt
  4155.     }%
  4156. % For a final copy, take out the rectangles
  4157. % that mark overfull boxes (in case you have decided
  4158. % that the text looks ok even though it passes the margin).
  4159. \def\finalout{\overfullrule=0pt}
  4160. % @image.  We use the macros from epsf.tex to support this.
  4161. % If epsf.tex is not installed and @image is used, we complain.
  4162. % Check for and read epsf.tex up front.  If we read it only at @image
  4163. % time, we might be inside a group, and then its definitions would get
  4164. % undone and the next image would fail.
  4165. \openin 1 = epsf.tex
  4166. \ifeof 1 \else
  4167.   \closein 1
  4168.   % Do not bother showing banner with post-v2.7 epsf.tex (available in
  4169.   % doc/epsf.tex until it shows up on ctan).
  4170.   \def\epsfannounce{\toks0 = }%
  4171.   \input epsf.tex
  4172. \newif\ifwarnednoepsf
  4173. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  4174.   work.  It is also included in the Texinfo distribution, or you can get
  4175.   it from ftp://ftp.tug.org/tex/epsf.tex.}
  4176. % Only complain once about lack of epsf.tex.
  4177. \def\image#1{%
  4178.   \ifx\epsfbox\undefined
  4179.     \ifwarnednoepsf \else
  4180.       \errhelp = \noepsfhelp
  4181.       \errmessage{epsf.tex not found, images will be ignored}%
  4182.       \global\warnednoepsftrue
  4183.     \fi
  4184.   \else
  4185.     \imagexxx #1,,,\finish
  4186.   \fi
  4187. % Arguments to @image:
  4188. % #1 is (mandatory) image filename; we tack on .eps extension.
  4189. % #2 is (optional) width, #3 is (optional) height.
  4190. % #4 is just the usual extra ignored arg for parsing this stuff.
  4191. \def\imagexxx#1,#2,#3,#4\finish{%
  4192.   % \epsfbox itself resets \epsf?size at each figure.
  4193.   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  4194.   \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  4195.   % If the image is by itself, center it.
  4196.   \ifvmode
  4197.     \nobreak\medskip
  4198.     \nobreak
  4199.     \centerline{\epsfbox{#1.eps}}%
  4200.     \bigbreak
  4201.   \else
  4202.     \epsfbox{#1.eps}%
  4203.   \fi
  4204. \message{paper sizes,}
  4205. % And other related parameters.
  4206. \newdimen\defaultparindent \defaultparindent = 15pt
  4207. \chapheadingskip = 15pt plus 4pt minus 2pt
  4208. \secheadingskip = 12pt plus 3pt minus 2pt
  4209. \subsecheadingskip = 9pt plus 2pt minus 2pt
  4210. % Prevent underfull vbox error messages.
  4211. \vbadness = 10000
  4212. % Don't be so finicky about underfull hboxes, either.
  4213. \hbadness = 2000
  4214. % Following George Bush, just get rid of widows and orphans.
  4215. \widowpenalty=10000
  4216. \clubpenalty=10000
  4217. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  4218. % using an old version of TeX, don't do anything.  We want the amount of
  4219. % stretch added to depend on the line length, hence the dependence on
  4220. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.  We
  4221. % call this whenever the paper size is set.
  4222. \def\setemergencystretch{%
  4223.   \ifx\emergencystretch\thisisundefined
  4224.     % Allow us to assign to \emergencystretch anyway.
  4225.     \def\emergencystretch{\dimen0}%
  4226.   \else
  4227.     \emergencystretch = \hsize
  4228.     \divide\emergencystretch by 45
  4229.   \fi
  4230. % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
  4231. % 4) hoffset; 5) binding offset; 6) topskip.  Then whoever calls us can
  4232. % set \parskip and call \setleading for \baselineskip.
  4233. \def\internalpagesizes#1#2#3#4#5#6{%
  4234.   \voffset = #3\relax
  4235.   \topskip = #6\relax
  4236.   \splittopskip = \topskip
  4237.   \vsize = #1\relax
  4238.   \advance\vsize by \topskip
  4239.   \outervsize = \vsize
  4240.   \advance\outervsize by 2\topandbottommargin
  4241.   \pageheight = \vsize
  4242.   \hsize = #2\relax
  4243.   \outerhsize = \hsize
  4244.   \advance\outerhsize by 0.5in
  4245.   \pagewidth = \hsize
  4246.   \normaloffset = #4\relax
  4247.   \bindingoffset = #5\relax
  4248.   \parindent = \defaultparindent
  4249.   \setemergencystretch
  4250. % @letterpaper (the default).
  4251. \def\letterpaper{{\globaldefs = 1
  4252.   \parskip = 3pt plus 2pt minus 1pt
  4253.   \setleading{13.2pt}%
  4254.   % If page is nothing but text, make it come out even.
  4255.   \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
  4256. % Use @smallbook to reset parameters for 7x9.5 (or so) format.
  4257. \def\smallbook{{\globaldefs = 1
  4258.   \parskip = 2pt plus 1pt
  4259.   \setleading{12pt}%
  4260.   \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
  4261.   \lispnarrowing = 0.3in
  4262.   \tolerance = 700
  4263.   \hfuzz = 1pt
  4264.   \contentsrightmargin = 0pt
  4265.   \deftypemargin = 0pt
  4266.   \defbodyindent = .5cm
  4267.   \let\smalldisplay = \smalldisplayx
  4268.   \let\smallexample = \smalllispx
  4269.   \let\smallformat = \smallformatx
  4270.   \let\smalllisp = \smalllispx
  4271. % Use @afourpaper to print on European A4 paper.
  4272. \def\afourpaper{{\globaldefs = 1
  4273.   \setleading{12pt}%
  4274.   \parskip = 3pt plus 2pt minus 1pt
  4275.   \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
  4276.   \tolerance = 700
  4277.   \hfuzz = 1pt
  4278. % A specific text layout, 24x15cm overall, intended for A4 paper.  Top margin
  4279. % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
  4280. \def\afourlatex{{\globaldefs = 1
  4281.   \setleading{13.6pt}%
  4282.   \afourpaper
  4283.   \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
  4284.   \globaldefs = 0
  4285. % Use @afourwide to print on European A4 paper in wide format.
  4286. \def\afourwide{%
  4287.   \afourpaper
  4288.   \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
  4289.   \globaldefs = 0
  4290. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  4291. % Perhaps we should allow setting the margins, \topskip, \parskip,
  4292. % and/or leading, also. Or perhaps we should compute them somehow.
  4293. \def\pagesizes{\parsearg\pagesizesxxx}
  4294. \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
  4295. \def\pagesizesyyy#1,#2,#3\finish{{%
  4296.   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  4297.   \globaldefs = 1
  4298.   \parskip = 3pt plus 2pt minus 1pt
  4299.   \setleading{13.2pt}%
  4300.   \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
  4301. % Set default to letter.
  4302. \letterpaper
  4303. \message{and turning on texinfo input format.}
  4304. % Define macros to output various characters with catcode for normal text.
  4305. \catcode`\"=\other
  4306. \catcode`\~=\other
  4307. \catcode`\^=\other
  4308. \catcode`\_=\other
  4309. \catcode`\|=\other
  4310. \catcode`\<=\other
  4311. \catcode`\>=\other
  4312. \catcode`\+=\other
  4313. \def\normaldoublequote{"}
  4314. \def\normaltilde{~}
  4315. \def\normalcaret{^}
  4316. \def\normalunderscore{_}
  4317. \def\normalverticalbar{|}
  4318. \def\normalless{<}
  4319. \def\normalgreater{>}
  4320. \def\normalplus{+}
  4321. % This macro is used to make a character print one way in ttfont
  4322. % where it can probably just be output, and another way in other fonts,
  4323. % where something hairier probably needs to be done.
  4324. % #1 is what to print if we are indeed using \tt; #2 is what to print
  4325. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  4326. % interword stretch (and shrink), and it is reasonable to expect all
  4327. % typewriter fonts to have this, we can check that font parameter.
  4328. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  4329. % Turn off all special characters except @
  4330. % (and those which the user can use as if they were ordinary).
  4331. % Most of these we simply print from the \tt font, but for some, we can
  4332. % use math or other variants that look better in normal text.
  4333. \catcode`\"=\active
  4334. \def\activedoublequote{{\tt\char34}}
  4335. \let"=\activedoublequote
  4336. \catcode`\~=\active
  4337. \def~{{\tt\char126}}
  4338. \chardef\hat=`\^
  4339. \catcode`\^=\active
  4340. \def^{{\tt \hat}}
  4341. \catcode`\_=\active
  4342. \def_{\ifusingtt\normalunderscore\_}
  4343. % Subroutine for the previous macro.
  4344. \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  4345. \catcode`\|=\active
  4346. \def|{{\tt\char124}}
  4347. \chardef \less=`\<
  4348. \catcode`\<=\active
  4349. \def<{{\tt \less}}
  4350. \chardef \gtr=`\>
  4351. \catcode`\>=\active
  4352. \def>{{\tt \gtr}}
  4353. \catcode`\+=\active
  4354. \def+{{\tt \char 43}}
  4355. %\catcode 27=\active
  4356. %\def^^[{$\diamondsuit$}
  4357. % Set up an active definition for =, but don't enable it most of the time.
  4358. {\catcode`\==\active
  4359. \global\def={{\tt \char 61}}}
  4360. \catcode`+=\active
  4361. \catcode`\_=\active
  4362. % If a .fmt file is being used, characters that might appear in a file
  4363. % name cannot be active until we have parsed the command line.
  4364. % So turn them off again, and have \everyjob (or @setfilename) turn them on.
  4365. % \otherifyactive is called near the end of this file.
  4366. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
  4367. \catcode`\@=0
  4368. % \rawbackslashxx output one backslash character in current font
  4369. \global\chardef\rawbackslashxx=`\\
  4370. %{\catcode`\\=\other
  4371. %@gdef@rawbackslashxx{\}}
  4372. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  4373. {\catcode`\\=\active
  4374. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  4375. % \normalbackslash outputs one backslash in fixed width font.
  4376. \def\normalbackslash{{\tt\rawbackslashxx}}
  4377. % Say @foo, not \foo, in error messages.
  4378. \escapechar=`\@
  4379. % \catcode 17=0   % Define control-q
  4380. \catcode`\\=\active
  4381. % Used sometimes to turn off (effectively) the active characters
  4382. % even after parsing them.
  4383. @def@turnoffactive{@let"=@normaldoublequote
  4384. @let\=@realbackslash
  4385. @let~=@normaltilde
  4386. @let^=@normalcaret
  4387. @let_=@normalunderscore
  4388. @let|=@normalverticalbar
  4389. @let<=@normalless
  4390. @let>=@normalgreater
  4391. @let+=@normalplus}
  4392. @def@normalturnoffactive{@let"=@normaldoublequote
  4393. @let\=@normalbackslash
  4394. @let~=@normaltilde
  4395. @let^=@normalcaret
  4396. @let_=@normalunderscore
  4397. @let|=@normalverticalbar
  4398. @let<=@normalless
  4399. @let>=@normalgreater
  4400. @let+=@normalplus}
  4401. % Make _ and + \other characters, temporarily.
  4402. % This is canceled by @fixbackslash.
  4403. @otherifyactive
  4404. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  4405. % That is what \eatinput is for; after that, the `\' should revert to printing
  4406. % a backslash.
  4407. @gdef@eatinput input texinfo{@fixbackslash}
  4408. @global@let\ = @eatinput
  4409. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  4410. % the first `\{ in the file would cause an error. This macro tries to fix
  4411. % that, assuming it is called before the first `\' could plausibly occur.
  4412. % Also back turn on active characters that might appear in the input
  4413. % file name, in case not using a pre-dumped format.
  4414. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
  4415.   @catcode`+=@active @catcode`@_=@active}
  4416. % These look ok in all fonts, so just make them not special.  The @rm below
  4417. % makes sure that the current font starts out as the newly loaded cmr10
  4418. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  4419. @textfonts
  4420. @c Local variables:
  4421. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  4422. @c page-delimiter: "^\\\\message"
  4423. @c time-stamp-start: "def\\\\texinfoversion{"
  4424. @c time-stamp-format: "%:y-%02m-%02d"
  4425. @c time-stamp-end: "}"
  4426. @c End:
  4427.